8
votes

While connecting to Amazon RedShift, I getting the below error:

2016-04-14 13:49:30 ERROR SQL Exception when connecting [Amazon](500150) Error setting/closing connection: General SSLEngine problem.
java.sql.SQLException: [Amazon](500150) Error setting/closing connection: General SSLEngine problem.
    at workbench.db.DbDriver.connect(DbDriver.java:546)
    at workbench.db.ConnectionMgr.connect(ConnectionMgr.java:244)
    at workbench.db.ConnectionMgr.getConnection(ConnectionMgr.java:172)
    at workbench.gui.components.ConnectionSelector.doConnect(ConnectionSelector.java:227)
    at workbench.gui.components.ConnectionSelector$1.run(ConnectionSelector.java:131)
Caused by: java.sql.SQLException: [Amazon](500150) Error setting/closing connection: General SSLEngine problem.
    at com.amazon.redshift.client.PGClient.<init>(Unknown Source)
    at com.amazon.redshift.core.PGJDBCConnection.connect(Unknown Source)
    at com.amazon.jdbc.common.BaseConnectionFactory.doConnect(Unknown Source)
    at com.amazon.jdbc.common.AbstractDriver.connect(Unknown Source)
    at workbench.db.DbDriver.connect(DbDriver.java:513)
    at workbench.db.ConnectionMgr.connect(ConnectionMgr.java:244)
    at workbench.db.ConnectionMgr.getConnection(ConnectionMgr.java:172)
    at workbench.gui.components.ConnectionSelector.doConnect(ConnectionSelector.java:227)

I am using SQL Workbench J to connect to the database system. The strangeness here it that the connection was working fine two days ago. This problem appeared from nowhere. Any idea??

We are following the exact steps written in the setup guide to add certificates to Java.

https://community.boomi.com/docs/DOC-2381

Am I missing anything here?

UPDATE

My Redshift database is SSL configured. We use SQL Workbench J (http://www.sql-workbench.net/) client to connect to that database. The issue now is that everytime we try to connect, we are getting the error I mentioned.

Below is our URL format:

jdbc:redshift://hostname:5439/dbname?ssl=true&sslmode=verify-full
3
Can you explain a bit more? - Dieter Meemken
Yes. I have updated the Question details. - Sudhendu

3 Answers

11
votes

It worked for me when I followed the solution given by cfregly on databricks forum. Please follow below URL for this solution:

https://forums.databricks.com/questions/867/ssl-connection-issues-with-redshift.html

Please try appending sslfactory value in the Connection URL string like below - it might work.

ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory

4
votes

Please add the following without the server certificate

ssl=true&sslfactory=com.amazon.redshift.ssl.NonValidatingFactory

The following would be the possible values for sslfactory

com.amazon.redshift.ssl.NonValidatingFactory
org.postgresql.ssl.NonValidatingFactory

Please see http://docs.aws.amazon.com/redshift/latest/mgmt/configure-jdbc-options.html

0
votes

Try the following.

Run the keystore keytool based on the Java install for the environment variable JAVA_HOME (you may have multiple java installs so just use the default). Use the default cacerts keystore that comes with the JRE which will have a password of "changeit". You need to download the Redshift Certificate.

Then install the certificate for example:

C:\Program Files\Java\jdk1.8.0_25\jre\bin>keytool.exe -keystore "C:\Program Files\Java\jdk1.8.0_25\jre\lib\security\cacerts" -import -alias redshift -file redshift-ssl-ca-cert.pem

It will prompt you for the password ("changeit") and then should say the key has been added. If it fails its probably because you are not an admin user, so if in linux use sudo or in windows open the command window as administrator.

Start MYSQL Workbench using the cacerts keystore and the password entered above eg:

C:\apps\SQL-Workbench-Build118>java -Djavax.net.ssl.trustStore="C:\Program Files\Java\jdk1.8.0_25\jre\lib\security\cacerts" -Djavax.net.ssl.trustStorePassword=changeit -jar sqlworkbench.jar

You should be able to use the URL above and it should now work.