Connection strings for Postgre SQL
Providers to use when connecting to Postgre SQL
» dotConnect for PostgreSQL (former Core Labs PostgreSQLDirect) (PgSqlConnection)
» Npgsql (NpgsqlConnection)
» PostgreSQL OLE DB Provider
» .NET Framework Data Provider for OLE DB (OleDbConnection)
» PostgreSQL ODBC Driver (psqlODBC)
» .NET Framework Data Provider for ODBC (OdbcConnection)
» Npgsql (NpgsqlConnection)
» PostgreSQL OLE DB Provider
» .NET Framework Data Provider for OLE DB (OleDbConnection)
» PostgreSQL ODBC Driver (psqlODBC)
» .NET Framework Data Provider for ODBC (OdbcConnection)
Finding this site useful?
-Say "Thanks" to Jimmy Engström and the other contributing developers!
-Thank you! »
-Say "Thanks" to Jimmy Engström and the other contributing developers!
-Thank you! »
dotConnect for PostgreSQL (former Core Labs PostgreSQLDirect)
Type: .NET Framework Class Library
Usage: Devart.Data.PostgreSql.PgSqlConnection
Usage: Devart.Data.PostgreSql.PgSqlConnection
Manufacturer: Devart
More info about this class library »
More info about this class library »
Standard
User ID=root;Password=myPassword;Host=localhost;Port=5432;Database=myDataBase; Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;
Npgsql
Type: .NET Framework Class Library
Usage: Npgsql.NpgsqlConnection
Usage: Npgsql.NpgsqlConnection
Manufacturer: Npgsql Development Team
More info about this class library »
More info about this class library »
Standard
Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=myPassword;
Using windows security
Server=127.0.0.1;Port=5432;Database=myDataBase;Integrated Security=true;
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.
Specifying protocol version
Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=myPassword;Protocol=3;
Valid values for the key Protocol is 2 or 3.
Loading ad...
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;
PostgreSQL OLE DB Provider
Type: OLE DB Provider
Usage: Provider=PostgreSQL OLE DB Provider
Usage: Provider=PostgreSQL OLE DB Provider
Manufacturer: PgOleDb Development Team
More info about this provider »
More info about this 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;
.NET Framework Data Provider for OLE DB
Type: .NET Framework Wrapper Class Library
Usage: System.Data.OleDb.OleDbConnection
Usage: System.Data.OleDb.OleDbConnection
Manufacturer: Microsoft
More info about this wrapper class library »
More info about this wrapper class library »
Bridging to PostgreSQL OLE DB Provider
This is just one connection string sample for the wrapping OleDbConnection class that calls the underlying OLEDB provider. See respective OLE DB provider for more connection strings to use with this class.
Provider=PostgreSQL OLE DB Provider;Data Source=myServerAddress;location=myDataBase;User ID=myUsername;password=myPassword;timeout=1000;
PostgreSQL ODBC Driver (psqlODBC)
Type: ODBC Driver
Usage: Driver={PostgreSQL}
Usage: Driver={PostgreSQL}
Manufacturer: PostgreSQL
More info about this driver »
More info about this driver »
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.
.NET Framework Data Provider for ODBC
Type: .NET Framework Wrapper Class Library
Usage: System.Data.Odbc.OdbcConnection
Usage: System.Data.Odbc.OdbcConnection
Manufacturer: Microsoft
More info about this wrapper class library »
More info about this wrapper class library »
Bridging to psqlODBC
This is just one connection string sample for the wrapping OdbcConnection class that calls the underlying ODBC Driver. See respective ODBC driver for more connection strings to use with this class.
Driver={PostgreSQL};Server=IP address;Port=5432;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
