Tomcat Mysql JDBC connection diagnosis
In case of your web application is unable to connect to the Mysql database, chec the following:
NOTE: No CLASSPATH setting is required. It can be empty.
4. check from mysql database side- the username/password you are using to login has GRANT permission.
5. check from the mysql server side- the mysql port (3306- default) is opened.
In case of your web application is unable to connect to the Mysql database, chec the following:
- Is your Web.xml (/var/lib/tomcat6/webapps/<..>) refering to the correct IP or host name refering to Mysql server, with correct username/password
- MySql server is enabled with network access (/etc/mysql/my.cnf) and bind address as 0.0.0.0.
- check "mysql-connector-java-5.1.18-bin.jar" (version may vary) in path: "/usr/share/java".
- If not available you can download the latest version from http://dev.mysql.com/downloads/connector/j/
- /usr/share/tomcat6/lib shall have a softlink pointing to mysql-connector-java-5.1.18-bin.jar -
- command for softlink: ln -s /usr/share/java/mysql-connector-java-5.1.18-bin.jar mysql.jar - run this command inside /usr/share/tomcat6/lib
- when you restart the tomcat server, check the catalina.out, does it showing any errors (/var/lib/tomcat6/logs/catalina.out)
NOTE: No CLASSPATH setting is required. It can be empty.
4. check from mysql database side- the username/password you are using to login has GRANT permission.
5. check from the mysql server side- the mysql port (3306- default) is opened.