aaron-kelley.net

My little corner of the Internet

MySQL, Tomcat 6, and Ubuntu 9.10: Blah

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.  :-P

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.

Tags: , ,

One Response to “MySQL, Tomcat 6, and Ubuntu 9.10: Blah”

  1. Kahën says:

    Hi,

    Thanks a lot for your post (found googling “configurer mysql tomcat ubuntu”) that solved my problem – exactly the same. As you say, there must exist a better way to do this, setting “security=no” is usually a bad point in a system presentation ;)

    I guess we can usefully read chapter “MySql DBCP example : 2. Context configuration” at :
    http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Non%20DBCP%20Solutions

    If I understand well, we have to configure a context tag in our context.xml file, in order to allow a jdbc connection for our mysqld.

    But this will be for another project :)

    Bye, and thanks again

Leave a Reply

This site is protected by Akismet. I now receive too many spam comments to manually check them all for misclassifications. If you suspect that your comment has been filtered as spam (i.e., it does not appear right away), please try rewording it and submitting again. Using no more than one hyperlink will also improve the chances of your comment not being accidentally filtered as spam.
2,893 spam comments detected since August 1, 2009.