Windows path in libpq connection control functions

I already wrote a post about using Windows paths in SQL statements. But today I was playing with SSL connections to PostgreSQL from MicroOLAP Database Designer for PostgreSQL and found one interesting thing:

warning Windows user! Replace your usual slashes (backslashes, actually) with the slashes like this one: ‘/’, in the file system path parameters passed to libpq database connection control functions, e.g. PQconnectdbParams, PQconnectdb, PQconnectStartParams etc.!

WRONG:

PQconnectdb(“dbname=’carsales’ host=’localhost’ port=5434 user=’sslguy’ password=” sslmode=’require’ sslcert=’C:\MySSL\postgresql.crt’ sslkey=’C:\MySSL\postgresql.key'”);

RIGHT:

PQconnectdb(“dbname=’carsales’ host=’localhost’ port=5434 user=’sslguy’ password=” sslmode=’require’ sslcert=’C:/MySSL/postgresql.crt’ sslkey=’C:/MySSL/postgresql.key'”);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s