What are the allowed format for sending "connection string" to the PQconnectdbParams
method to connect to Postgres DB?
I am trying the following, but it's not working and receiving timeout errors always. I am not sure what I was doing is wrong.
provider_dsn := 'host=xxx.xxx.us-west-2.rds.amazonaws.com port=5432 dbname=dbname password=my_password user=user_name'
Error message receiving is as follows
ERROR: could not connect to the postgresql server: timeout expired
I can provide further details if required.
Note: I can connect the DB using psql
command from the terminal but can't when I use PQconnectdbParams
with same credentials.
Best Answer
You are mixing up the different connection functions.
Your call would be correct with
PQconn
.PQconnectdbParams
takes two parameters per connection string keywordReplace
PQconnectdbParams
withPQconn
and you should be fine.