Unable to Access RDS with JDBC in AWS

Question:

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:-

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.

Answer:

It could be that your instance is in a VPC and your RDS instance isn’t set up in a VPC subnet group.

If you want to connect to an RDS instance from a server instance in a VPC, your RDS instance has to be deployed in a VPC subnet.

http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.CreateDBSubnetGroup.html

Leave a Reply