PostgreSQL#
Querona uses the Npgsql ADO.net driver for PostgreSQL connectivity. NpgSQL driver is bundled with Querona, and no additional installation is required.
Example connection strings#
For a complete list of connection string parameters see Npgsql Connection String Parameters.
Encrypted connection (SSL/TLS)#
By default PostgreSQL connections are unencrypted, but you can turn on SSL/TLS encryption if you wish.
Specify SSL Mode
in the connection string, setting it to either Require
(connection will fail if the server isn’t set up for encryption),
or Prefer
(use encryption if possible but fallback to unencrypted otherwise).
Example connection string with SSL enabled. Notice the SSL Mode=Prefer
at the end of connection string:
Host=[Servername];Username=[Username];Password=[Password];Database=postgres;Port=5432;SSL Mode=Prefer;
Note that by default, Npgsql will verify that your server’s certificate is valid.
If you’re using a self-signed certificate, this will fail.
You can instruct Npgsql to ignore this by specifying Trust Server Certificate=true
in the connection string.
Example connection string with SSL enabled and self-signed server certificate.
Notice the SSL Mode=Prefer
and Trust Server Certificate=true
at the end of connection string:
Host=[Servername];Username=[Username];Password=[Password];Database=postgres;Port=5432;SSL Mode=Prefer; Trust Server Certificate=true;