PostgreSQL connection strings

PostgreSQL OLE DB Provider

Standard

PgOleDb requires a PQLib of version 7.4 or up and it also requires a backend of version 7.4 or up. Timestamps are only guarenteed to work with backends of version 8.0 and up.

Provider=PostgreSQL OLE DB Provider;Data Source=myServerAddress;location=myDataBase;User ID=myUsername;password=myPassword;timeout=1000;

Other valid Provider values is "PostgreSQL" and "PostgreSQL.1"

Standard alternative

Some reported problems with the above one. Try removing the timeout parameter to make it work.

Provider=PostgreSQL OLE DB Provider;Data Source=myServerAddress;location=myDataBase;User ID=myUsername;password=myPassword;

PostgreSQL ODBC Driver (psqlODBC)

Standard

Driver={PostgreSQL};Server=IP address;Port=5432;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

ANSI

Driver={PostgreSQL ANSI};Server=IP address;Port=5432;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

Unicode

Driver={PostgreSQL UNICODE};Server=IP address;Port=5432;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

SSL

Secure sockets layer for this driver only works from version 8.0 and above.

Driver={PostgreSQL ANSI};Server=IP address;Port=5432;Database=myDataBase;Uid=myUsername;Pwd=myPassword;sslmode=require;

Please note that sslmode=require is case sensitive, it should be written in lower case letters.

Npgsql

Standard

Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=myPassword;

Setting command timeout

Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=myPassword;CommandTimeout=20;

The CommandTimeout parameter is measured in seconds and controls for how long to wait for a command to finish before throwing an error.

Setting connection timeout

Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=myPassword;Timeout=15;

The Timeout parameter is measured in seconds and controls for how long to wait for a connection to open before throwing an error.

SSL activated

Server=127.0.0.1;Port=5432;Database=myDataBase;Userid=myUsername;Password=myPassword;Protocol=3;SSL=true;SslMode=Require;

Without SSL

Server=127.0.0.1;Port=5432;Database=myDataBase;Userid=myUsername;Password=myPassword;Protocol=3;SSL=false;SslMode=Disable;

Controlling pooling mechanisms

Server=127.0.0.1;Port=5432;Database=myDataBase;Userid=myUsername;Password=myPassword;Protocol=3;Pooling=true;MinPoolSize=1;MaxPoolSize=20;ConnectionLifeTime=15;