title: Connecting to Postgres Heroku DB through Intellij IDEA
body: <p>I've been trying to connect to my postgres DB all day.  I can do it through pgAdmin, but I can't connect through mySQLWorkbench to migrate it and also can't connect through Intellij IDEA.  We'll start w/Intellij though...</p>
  
  <p>So, when I try to connect through IntelliJ, I get this...</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I take this to mean that I need a certificate, since I'm using SSL (because it's a postgres/heroku).  So, I run my handy InstallCert like so...</p>
  
  <pre><code>java InstallCert ec2-54-243-235-169.compute-1.amazonaws.com:5432
  </code></pre>
  
  <p>And get this back:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>So why can't I get a cert for this, but it connects with no problem with pgAdmin!?  Does anybody have a clue at all?</p>