Trying to set up a JSP application on Ubuntu 9.10, using Tomcat 6 and MySQL 5.1 (both from the Ubuntu repositories). I was getting a curious error when trying to get a connection to the MySQL database from the JDBC DriverManager:
SQLException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
SQLState: 08S01
VendorError: 0
After searching for a while and going through some solutions that didn’t work for me, I found the answer here. I’m re-posting it because that answer is posted in Spanish.
All you have to do is open /etc/init.d/tomcat6 in your favorite text editor (as root), find the line that looks like TOMCAT6_SECURITY=yes, and change it to TOMCAT6_SECURITY=no. Then, restart the Tomcat server (sudo service tomcat6 restart). Ta da!! MySQL connections are now working.
Now, there’s probably a better way to do this that doesn’t involve completely turning off “TOMCAT6_SECURITY,” but this seems fine for a small test project which is what I’m working on (it will eventually be deployed on the JBoss server). I’ll be sure to update this post if I find it… or if you know anything, leave a note in the comments below.