Tuesday, August 28, 2012

Java/JDBC connect to Amazon RDS (MySQL) with SSL

First you need to set your JDBC url to something like the following:
jdbc:mysql://whatever_publichost_your_db_has.rds.amazonaws.com/db_name?autoReconnect=true&useSSL=true&requireSSL=true

Notice the useSSL and requireSSL as connection parameters
Then you need to import the following SSL certificate into your Java cacerts trusted store:
sudo keytool -import -keystore /PathToYourJDK_OR_JRE_lib/security/cacerts -file path_to_downloaded_from_above_file/mysql-ssl-ca-cert.pem

Set the correct JDBC username/password when connecting and all should be fine.

2 comments:

Anonymous said...

geotorelxzp consolidation loan
debt consolidation loans

Anonymous said...

Nice post. I was checking continuously this blog and I am impressed!
Very useful info particularly the last part :) I care for such information much.

I was seeking this certain information for a very long time.
Thank you and best of luck.

Here is my site; bmr calculator to lose weight