How can I solve this exception

gamjaradio
gamjaradio used Ask the Experts™
on
By using Sybase jConnect-6_0 , I make connection and didn't cut it off. However , when it is about 30 ~ 100 hours long , then it throw the Exception like below
 
java.sql.SQLException: JZ006: Caught IOException: com.sybase.jdbc3.jdbc.SybConnectionDeadException: JZ0C0: Connection is already closed.
 at com.sybase.jdbc3.jdbc.ErrorMessage.createIOEKilledConnEx(Unknown Source)
 at com.sybase.jdbc3.jdbc.ErrorMessage.raiseErrorCheckDead(Unknown Source)
 at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
 at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
 at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source)
 at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source)
 at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
 at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
 at com.sybase.jdbc3.jdbc.SybStatement.queryLoop(Unknown Source)
 at com.sybase.jdbc3.jdbc.SybStatement.executeQuery(Unknown Source)
 at com.sybase.jdbc3.jdbc.SybPreparedStatement.executeQuery(Unknown Source)

What's the reason of it?
 
 
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
Are you using a connection pool? If so, you might need to tune the parameters somewhat.
May be it happens because of some network problems or because listener of the DB is restarted or something like that?! I think that it's not good idea to keep permanently one and the same connection to the DB and to rely on this connection.
Mick BarryJava Developer
Top Expert 2010
Commented:
Its happening because the server is closing the (idle) connection according to its timeout
You should close the connection once you are done, that will fix it.
Or you could adjust the database timeout on the server but preferable to close the connection once done.

Top Expert 2016

Commented:
:-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial