I am finding hard time connecting to RDS using JDBC connection, I am able to connect through MYSQL workbench, I deployed my WAR file in A WSwhich is running tomcat, this WAR file has my JDBCcode connecting to RDS, but I am not even able to establish connection. My code is as below:-
public static Connection getconnection(){
String connectionUrl = "jdbc:mysql://testinstance.cj3ixhryi3fb.us-west-2.rds.amazonaws.com:3306/testDB";
String dbUser = "testuser";
String dbPwd = "usertest";
Connection conn = null;
try {
conn = (Connection) DriverManager.getConnection(connectionUrl, dbUser, dbPwd);
System.out.println("conn Available");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("fetch otion error"+e.getLocalizedMessage());
}
return conn;
}
I included all the necessary jar files, and rules security groups but no luck.
I am using the EC2 security group for RDS. Does RDS will use ec2 security groups? or I need to have different security group for RDS?
the testinstance is a working link if any one wanna test.