I\'m trying to connect spoon to a Heroku PostgreSQL instance using the JDBC driver that came with Spoon. Heroku requires SSL for it\'s stand alone PostgreSQL instances, whic
The basic problem seems to be the SSL handshake. Excerpt from your error messages:
Caused by: sun.security.validator.ValidatorException: PKIX path building failed:
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
This is not a PostgreSQL specific problem, it's a pure SSL thing. Using these error messages you can find quite some help on this site. Skimming through them this answer looks promising to me and it might guide you into the right direction:
https://stackoverflow.com/a/6908991/947357
I found the issue. Simply passing
ssl = true
isn't enough for JDBC, you also need to install the correct root certificates in your Java keystore so that PgJDBC can verify the remote certificate.
If you don't want to configure the root certificate store you may instead pass:
ssl = true
sslfactory = org.postgresql.ssl.NonValidatingFactory
though doing so disables man-in-the-middle attack protection, so your SSL session no longer has reliable end-to-end security.
See the Heroku docs here:
http://devcenter.heroku.com/articles/connecting-to-relational-databases-on-heroku-with-java#connecting_to_a_dedicated_database_remotely
(Warning about SSL security added by Craig Ringer)