I created DB Instance (MySQL) with Publicly Accessible option. In DB Security group, I opened MySQL Port for EC2 instance security group(Web server). In EC2 security group it allows ssh, web server ports. I can able to connect DB Instance from EC2 instance. I deployed web app on web server and it can't able to connect with RDS Instance.
I am getting the exception in my local web server:
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Server connection failure during transaction. Due to underlying exception: 'java.net.UnknownHostException: "kbawstry2.cdhtaamn5ynq.us-east-1.rds.amazonaws.com"'.
Using MySQL WorkBench, I can connect to RDS DB Instance using TCP/IP SSH Tunnelling option. But in Java Programming How can I connect with database?
Thanks in advance.