File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

Mysql + Tomcat issue

San Muthu
Greenhorn

Joined: Sep 06, 2012
Posts: 3
Hi,

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?

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


** BEGIN NESTED EXCEPTION **

com.mysql.jdbc.CommunicationsException
MESSAGE: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.io.EOFException

STACKTRACE:

java.io.EOFException
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1913)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2304)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2803)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3170)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3099)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1169)
----------------------------------------------------------------------------
----------------------------------------------------------------------------
at java.lang.Thread.run(Thread.java:722)


** END NESTED EXCEPTION **
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16228
    
  21

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: http://aspose.com/file-tools
 
subject: Mysql + Tomcat issue