Setting connection timeout using NpgsqlConnection

Connection string

This Npgsql connection string can be used for connections to PostgreSQL.

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.