2
I created a database on 000webhost and created a PDO connection to access it from my localhost in vertrigo
<?php
//CONSTANTES
define('HOST', 'databases.000webhost.com');
define('USUARIO', 'meuusuario');
define('SENHA', 'minhasenha');
define('DB', 'id1342846_central');
// FUNÇÃO DE CONEXÃO
function conecta() {
$dns = "mysql:host=" . HOST . ";dbname=" . DB;
try {
$conn = new PDO($dns, USUARIO, SENHA);
$conn -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $conn;
} catch(PDOException $erro) {
echo $erro -> getMessage();
}
}
?>
however the connection is denied and presenting the following information SQLSTATE[HY000] [2002] No connection the p to be made because the target corner actively refused them. there is some way to connect me to this database externally ?
Welcome, for being in charge of a free service, to 000WebHost does not allow setting remote access, to be able to access the configuration you must sign a plan Premium, as you can see in this question on forum theirs.
– NoobSaibot