Advanced Postgres Connection
  • 18 Jul 2022
  • 1 Minute to read
  • Dark
    Light

Advanced Postgres Connection

  • Dark
    Light

Creating and using a custom connection string to integrate with Postgres allows specific parameters to be set to ensure a successful connection.  The following article will show how the connection string should be configured to allow SSL. 

The platform currently uses Npgsql v5.0.7 to connect with Postgres. By default, Npgsql will validate the server's certificate; this will fail if the certificate is self-signed. Instruct Npgsql to ignore this by specifying Trust Server Certificate=true in the connection string. 

To precisely control how the server's certificate is validated, register UserCertificateValidationCallback on NpgsqlConnection.

Additional Resources


Setup

  1. In the Folder Tree, navigate to System > Integrations > Databases.
  2. Select Create Connection in the Top Bar.
  3. In the Database Integration window, give the connection a Name, select POSTGRES as the Database Type
  4. Set Custom Connection String to True
  5. Edit the below example string parameters to match the Npgsql properties and place the string into the Connection String text box.
    Host=hostname;Database=databasename;Port=5432;Integrated Security=False;Username=postgres;Password=xxx;TrustServerCertificate=True


    For further information on Integrations, visit the Decisions Forum.

Was this article helpful?