permaculture playing cards*
The moose likes Tomcat and the fly likes Mysql + Tomcat issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Mysql + Tomcat issue" Watch "Mysql + Tomcat issue" New topic

Mysql + Tomcat issue

San Muthu

Joined: Sep 06, 2012
Posts: 3

I have a web application running in Tomcat Server (6) which uses the Mysql DB(5.5) in Solaris SPARC machine. It runs fine when i start the server but next day when i check it seems db connection gets closed (though the server and mysql service is running) and i'm getting the below exception. How to resolve this?

com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed due to underlying exception/error:


MESSAGE: Communications link failure due to underlying exception:


at com.mysql.jdbc.MysqlIO.readFully(
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(
at com.mysql.jdbc.MysqlIO.checkErrorPacket(
at com.mysql.jdbc.MysqlIO.sendCommand(
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(
at com.mysql.jdbc.Connection.execSQL(
at com.mysql.jdbc.Connection.execSQL(
at com.mysql.jdbc.Statement.executeQuery(

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15964

We can't tell anything about how your program is using the connection. Is it coming from a connection pool or hard-wired into the application (which is not recommended)? Are you opening/obtaining the connection with the expectation that you can talk to it any time you want, or getting it only when you are planning to use it immediately?

Database connections are fairly expensive. They tie up a limited number of resources on the database server. For this reason, most connections eventually time out and disconnect from the server. A properly-configured database connection pool properly used by the webapp(s) can deal with that.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: Mysql + Tomcat issue
Similar Threads
Communications link failure due to underlying exception
Help~~~ cannot login after rollback to 2.1.6 from 2.1.7
Broken pipe Error
JForum performance tuning for production
Caused by: com.mysql.jdbc.CommunicationsException