2015-06-04 6 views
5

ich versucht habe zu meiner Postgres DB des ganzen Tages zu verbinden. Ich kann es über pgAdmin tun, aber ich kann keine Verbindung über mySQLWorkbench herstellen, um es zu migrieren, und kann auch keine Verbindung über Intellij IDEA herstellen. Wir werden allerdings w/Intellij beginnen ...zu Postgres Heroku DB über IntelliJ IDEA Connecting

Also, wenn ich versuche, durch IntelliJ zu verbinden, bekomme ich diese ...

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 

ich das so zu verstehen, dass ich ein Zertifikat benötigen, da Ich benutze SSL (weil es ein Postgres/Heroku ist). Also, ich betreibe meine handliche InstallCert wie so ...

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

und nutzen Sie diesen zurück:

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 

Warum kann ich nicht ein CERT für diese, aber es verbindet ohne Probleme mit pgAdmin !? Hat jemand eine Ahnung?

Antwort

21

Um neue Verbindung zu Ihrem PostreSQL auf Heroku in IntelliJ IDEA hinzufügen müssen Sie:

  1. Datenbank-Tool Fenster/Neu/Datenquelle/PostreSQL

  2. Put Host, Port, Datenbank, Benutzer , Passwort, die Sie auf https://postgres.heroku.com/databases

  3. zum Registerkarte Erweitert finden und setzen:

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

+0

, die nicht für mich arbeiten, erhalte ich eine Fehlermeldung: java.lang.ClassNotFoundException: org.postgresql.ssl.NonValidatingFactory [2017.01.20 19.52.20] \t auf Java. net.URLClassLoader.findClass (URLClassLoader.java:381) [2017-01-20 19:52:20] \t bei java.lang.ClassLoader.loadClass (ClassLoader.java:424) [2017-01-20 19: 52:20] \t bei ... – Pille

+0

Für mich funktionierte das. Vielen Dank! – studersi