Let's say I have a MySQL 4.12 database, opened to the internet on
111.111.111.111 allowing all incoming and outgoing ports. I have a username
and password setup, which CAN connect to this database, from
222.222.222.222.
Also on 222.222.222.222, which is running Tomcat, I have a Java servlet,
called, say, servlet.class in WEB-INF/classes. servlet.class has permissions
755, as does WEB-INF/classes.
Additionally, I have on 222.222.222.222 under WEB-INF/lib
mysql-connector-java-3.1.7-bin.jar also with permissions 755.
The system (222.222.222.222) is running on Linux Kernel version
2.6.9-22.0.2.ELsmp. I am running Java 1.5.0_05. Bear in mind, the very same
parameters, from the same machine (222...) connect to the very same db
(111...) under php (so there is no firewall issue on 111...). Additionally,
if I run a MySQL DB (version 4.0.25) on 222... and connect to it (thus, on
'localhost') I can connect no problem. It is only when I go to connect to a
remote machine that I get the following stack trace:
java.sql.SQLException: Server connection failure during transaction.
Attempted reconnect 3 times. Giving up. at
com.mysql.jdbc.Connection.createNewIO(Connection.j ava:1704)
at com.mysql.jdbc.Connection.(Connection.java:491)
at
com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:346)
at java.sql.DriverManager.getConnection(DriverManager .java:525)
at java.sql.DriverManager.getConnection(DriverManager .java:171)
I have ruled out firewall issues here (because I can connect from the same
machine with the same parameters under php), as well, I believe, permissions
issues here. Somehow, it (MySQL ConnectorJ) is NOT able to obtain a
connection. I have looked at the parameters passed through the call stack,
and they are correct. Is there a bug with MySQL Connector J for remote
connections? OR am I missing something stupid here?-Ike