I'm trying to work with a PostGres database hosted on heroku, I need to connect to it from my local machine. Heres an example of the credentials I'm using:
params:
driver: pdo_pgsql
host: e5-31-281-414-28.compute-1.amazonaws.com
dbname: b6m44bwjmaa41n
user: sgjwiakskki
password: e4ks28ajgs87
port: 5432
^^ I altered those credentials, but thats the format they're in.
When I try connecting using pg_connect
, like this:
$dbconn = pg_connect("e5-31-281-414-28.compute-1.amazonaws.com port=5432 dbname=b6m44bwjmaa41n user=sgjwiakskki password=e4ks28ajgs87") or die('Could not connect: ' . pg_last_error());
I get this error:
pg_connect(): Unable to connect to PostgreSQL server: could not translate host name "***.compute-1.amazonaws.com" to address: Unknown host
When I try connecting using Doctrines DBAL package, I get the same error:
Uncaught exception 'PDOException' with message 'SQLSTATE[08006] [7] could not translate host name "e5-31-281-414-28.compute-1.amazonaws.com" to address: Unknown host' in C:\wamp64\www\project\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\AbstractPostgreSQLDriver.php on line 85
I read all the tutorials on connecting to heroku from outside, but I can't figure this one out. I can connect through the command line using the heroku toolbelt. I can connect with pgAdmin 3. But can't seem to connect with a web app like this.