I have one two ec2 instances. One is a web service with DB and another one is a simple web module. Web service connects to DB locally while I want web module instance to connect to the web service instance DB. Both have a stack of Java- Hibernate inside Tomcat with MySQL as database.
I have created one security group and assigned that to both the server. Configuration for DB is as below:
MySQL - TCP Protocol - 3306 port - Source as the Group ID for the same configuration.
The hibernate configuration for web module looks like below:
<property name="connection.url">jdbc:mysql://<web service server ip>:3306/<db name></property>
<property name="connection.username">root</property>
<property name="connection.password">password</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
But I am not able to connect to the DB. If I change the server configuration to accept any IP connection then I can connect but with security group, it fails.
Any pointers?