Connect to retool DB with PHP

Hi All,

Im trying to do something which i thought would be trivial. I am trying to connect to the retool database with PHP and i am having no luck. I can connect to any mysql db with ease but this is proving to be impossible.

I tried PDO and PG_Connect and i get the error:

pg_connect(): Unable to connect to PostgreSQL server: ERROR:  Endpoint ID is not specified. Either please upgrade the postgres client library (libpq) for SNI support or pass the endpoint ID (first part of the domain name) as a parameter: '?options=endpoint%3D <endpoint-id >'.

I have version 15 of libq installed

This is my connection string

$conn_string = "host=ep-divine-term-917812.us-west-2.retooldb.com dbname=retool user=retool password=myPassword sslmode=require options='--endpoint=ep-divine-term-917812'";
$dbconn = pg_connect($conn_string);

if (!$dbconn) {
    echo "Connection failed.";
} else {
    echo "Connection successful.";
    pg_close($dbconn);
}

What am i doing wrong? This should be straightforward shouldnt it?

I got it working, the syntax for is option=endpoint=YourEndPoint and the endpoint is the first string of characters before the first .

3 Likes