Npgsql connection strings

Connects to

PostgreSQL

  • 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.

  • 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;
Problems connecting?
Get answer in the PostgreSQL Q & A forum
.NET Framework Class LibraryNpgsql.NpgsqlConnectionInfo and class library downloads

Articlesread all »

Providers

Connect

Articlesread all »

Didn't find your connection string?

Start over from the connection string reference index - or try a search!

In the Q&A forums you can ask your own question and let somebody help you.

The knowledge articles contains solutions and guides.