shyamkant.dhamke@xxxxxxxxx wrote: > I need sample C program ( running on Unix ) to connect to PostgreSQL 9.3.5 (SSL Enabled) database. #include <stdio.h> #include <libpq-fe.h> int main(int argc, char **argv) { PGconn *conn; conn = PQconnectdb("host=... port=... dbname=... user=... password=..."); if (conn == NULL) { fprintf(stderr, "Out of memory.\n"); return 1; } if (PQstatus(conn) != CONNECTION_OK) { fprintf(stderr, PQerrorMessage(conn)); PQfinish(conn); return 1; } PQfinish(conn); return 0; } Essentially, there's nothing special to do in the C code. You have to have the server set up for SSL (ssl=on) and the certificate and key in place. On the client side, you can add "sslmode=require" as connection option to make sure that no unencrypted connection is attempted. Yours, Laurenz Albe -- Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin