0

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?

rishi
  • 2,564
  • 6
  • 25
  • 47

1 Answers1

1

I think that your DB server is setup to refuse external connections. Solution

Community
  • 1
  • 1
FHR
  • 77
  • 6
  • I did grant privileges. Also my /etc/my.cnf does not have a reference to 127.0.0.1. Still while deploying web war I am not able to connect to DB. – rishi Jan 24 '15 at 12:29