We have a pristine Debian 7 on a virtual server. Tomcat7 with OpenJDK 1.7.0_65 connecting to a local MySQL 5.5 installation. A tomcat application with ColdFusion core (Razuna, a MAM) throws this exception when installing:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
As far as looking this exception up, there are a multitude of reasons for the exception itself, so the message after the exception type is important.
We've dumped the ColdFusion database connection object, and it looks like this:
struct
connectionretries 0
connectiontimeout 120
connectstring zeroDateTimeBehavior=convertToNull
databasename razuna
description [empty string]
displayname mysql
drivername com.mysql.jdbc.Driver
hoststring jdbc:mysql://localhost:3306/razuna?cacheResultSetMetadata=false&autoReconnect=true&useEncoding=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
initstring [empty string]
logintimeout 120
maxconnections 3
name mysql
password [thecorrectpassword]
perrequestconnections false
port 3306
server localhost
sqldelete true
sqlinsert true
sqlselect true
sqlstoredprocedures true
sqlupdate true
username razuna
It looks good. So we've tried to diagnose the problem on the MySQL side. After switching on general logging, we can see that there's no entry in the general log. The last things we thought of was to give the Tomcat7 user an interactive shell, then try to log into MySQL manually using the same parameters (host, port, user, password), and this works like a charm. Also, comparing the softwares of another server (with the same provider) where the same application works under the same circumstances, everything seems to be the same: Debian version, Java version and flavour, Tomcat-version.
We have no real idea how to proceed from here. Any help is appreciated.
Edit 1: We've already tried it with the root MySQL user, just to rule out the possibility of it being some strange permissions problem with the dedicated user for the application. The error message was the same.