Connecting to Heroku Postgres Via DataGrip

Issue

Unable to connect to Heroku Postgres via DataGrip or a similarly configured client.

Resolution

In general, this issue is caused by clients not trusting Unknown CAs out of the box. Each client (and Postgres driver) may need to be specifically configured to trust unknown CAs.

The DataGrip client specifically, this issue presents itself in the form of the following error when connecting:

[08006] SSL error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

To resolve you will need to do the following (assuming jdbc driver).

  1. Input your connection details in the General tab
  2. In the SSH/SSL table, enable "Use SSL"
  3. In the Advanced Tab, scroll down until you find the setting sslfactory and set that value = org.postgresql.ssl.NonValidatingFactory

At this point you can retry the connection and should be able to successfully connect.

See https://www.jetbrains.com/help/datagrip/how-to-connect-to-heroku-postgres.html for more information.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support