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).
- Input your connection details in the General tab
- In the SSH/SSL table, enable "Use SSL"
- 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.