Connect to Postgres Heroku DB via Intellij IDEA

I have been trying to connect to my postgres database all day. I can do this through pgAdmin, but I cannot connect through mySQLWorkbench to migrate it, and I cannot connect through Intellij IDEA. We will start with Intellij, though ...

So, when I try to connect through IntelliJ, I get this ...

Connection to Sinthetics failed java.sql.SQLException: SSL error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 

I believe that I need a certificate since I use SSL (because it is postgres / heroku). So, I run my convenient InstallCert, for example ...

 java InstallCert ec2-54-243-235-169.compute-1.amazonaws.com:5432 

And return this:

 Loading KeyStore /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/security/cacerts... Opening connection to ec2-54-243-235-169.compute-1.amazonaws.com:5432... Starting SSL handshake... javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:953) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343) at InstallCert.main(InstallCert.java:87) Caused by: java.io.EOFException: SSL peer shut down incorrectly at sun.security.ssl.InputRecord.read(InputRecord.java:482) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:934) ... 4 more Could not obtain server certificate chain 

So why can not I get a certificate for this, but it is connected to pgAdmin without problems !? Does anyone have a key?

+6
source share
2 answers

To add a new connection to your PostreSQL on Heroku in Intellij Idea, you need to:

  • Database Tool Window / new / data source / PostreSQL

  • Put the host, port, database, user, password, which you will find at https://postgres.heroku.com/databases

  • Go to the "Advanced" tab and place:

    • ssl: true
    • sslfactory: org.postgresql.ssl.NonValidatingFactory
  • Profit

+30
source

I have the same problem, downgrade to the minor version of Postgre Driver worked for me.

PostgreDriverSettings:

PostgreDriverSettings

0
source

All Articles