Search code examples
postgresqlssldatagrip

DataGrip Postgres SSL error: sun.security.validator.ValidatorException


DataGrip won't connect to my Postgres instance, but I can connect fine via psql on the terminal:

psql -h dbhost.com reps username
>Password for user... (connects)

However, IntelliJ DataGrip throws:

Connection to username@dbhost.com failed.
SSL error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

The connection string it uses is jdbc:postgresql://dbhost.com:5432/dbname


Solution

  • Try disabling the SSL checkbox in the SSH/SSL tab in your database's property window.

    Then append ?sslmode=require to the URL in the General tab so that it reads something like: jdbc:postgresql://localhost:5432/reps?sslmode=require