通过Intellij IDEA连接到Postgres Heroku DB

dar*_*ter 6 postgresql ssl heroku intellij-idea

我一直在努力连接到我的postgres DB.我可以通过pgAdmin来实现,但我无法通过mySQLWorkbench连接来迁移它,也无法通过Intellij IDEA连接.我们将开始w/Intellij虽然......

所以,当我尝试通过IntelliJ连接时,我得到了这个......

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
Run Code Online (Sandbox Code Playgroud)

我认为这意味着我需要一个证书,因为我使用的是SSL(因为它是一个postgres/heroku).所以,我像这样运行我方便的InstallCert ......

java InstallCert ec2-54-243-235-169.compute-1.amazonaws.com:5432
Run Code Online (Sandbox Code Playgroud)

得到这个:

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
Run Code Online (Sandbox Code Playgroud)

那么为什么我不能为此获得证书,但它与pgAdmin没有问题连接!?有人有线索吗?

gs_*_*lad 31

要在Intellij Idea中添加Heroku上PostreSQL的新连接,您需要:

  1. 数据库工具窗口/新建/数据源/ PostreSQL

  2. https://postgres.heroku.com/databases上找到您找到的主机,端口,数据库,用户,密码

  3. 转到"高级"选项卡并放置:

    • ssl:是的
    • sslfactory:org.postgresql.ssl.NonValidatingFactory
  4. 利润.