Error connecting to a PostgreSQL Azure database using libpq

0

I am trying to connect to a PostgreSQL Azure database using libpq on Windows 10. The syntax is as below --

PQinitSSL(1);
PGconn* pConn = PQconnectdb("host=nameofhost.postgres.database.azure.com port=5432 dbname={your_database} user=postgres@nameofhost password={your_password} sslmode=require");
ConnStatusType ist = PQstatus(pConn);

The connection status is CONNECTION_BAD, and the error message is "SSL SYSCALL error: Connection reset by peer (0x00002746/10054)".

Note that I set up the windows firewall rules correctly. And on the same machine, pgAdmin is able to connect to this PostgreSQL Azure database successfully.

Your help/suggestion is greatly appreciated.

postgresql
azure
libpq
asked on Stack Overflow Feb 4, 2020 by HongY • edited Feb 4, 2020 by Ankit Deshpande

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0