Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mysql + Tomcat issue

 
San Muthu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18020
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic