Please help me on the exception which am getting while
executing stored procedure from my standalone java application which has pool of connection objects.
Error :JZ006: Caught IOException:
Connection is already closed.
java.sql.SQLException: JZ006: Caught IOException:
Connection is already closed.
Am using sybase db version ASE 15.0.3/EBF17775
and using driver jar jconn3.jar 6.05/EBF16676(Recently
Since upgrade facing the above exception now and then.
Isn't it possible that this is connected to the other exception you're encountering? If the Connection already closed is always preceded by the Read timed out exception, then perhaps the connection gets closed after that timeout and your exception handling code (perhaps a finally block) closes it again? And perhaps the upgrade caused some change to the timeout interval?
(I personally find it amusing that a call on Connection.close() may fail. I just catch and log any exceptions raised by this call and that's it, I wouldn't know what to do with these exceptions annyway.)
Thank you for your response and for your valuable time.
Into the issue ---it is not related to the other exception which i have encountered and posted.This is completely different exception which i encountered on one day and other on other day.This SybConnectionDeadException am getting it now and then ..... i suspect this could be because of the version upgrades of jconn3.jar , commons-pool-1.5.5.jar and commons-dbcp.jar.Please help.Thanks in advance.
Your exception indicates that "Connection is already closed.". In that case you should be getting an exception at line:
CallableStatement cls = connection.prepareCall("SOME STOREDPROCEDURE");
Because at this line you are trying to creates a CallableStatement on a closed connection. As per Connection.prepareCall() api,
SQLException - if a database access error occurs or this method is called on a closed connection
Sometimes it does happen that you unintentionally close your connection at some point in your code. I would suggest for test purposes to check the status of your connection using isClosed() before you start doing stuff with it. Also check how your connection is handled, particularly at what points you close it. Use search in Eclipse or RAD for this purpose.
Thanks for your response.
Into the issue exception is not getting thrown at preparecall ....exception is coming at line executequery().One more thing need to say is connection is no where it is closed once it is created untill it finishes the retrieval from resultset and in finally am closing the connection.If connection is closed in the code before calling executequery() then it will happen everytime i do call this block of code , so it is not happening everytime i do call and this code is running since ages.But here i want mention clearly is after updating the jars (2 to 3 months back updated) which mentioned earlier am facing this type of issue once in month or two.This block of code runs roughly for thousands to lacks of times in a month and almost all the times it is executing perfectly.Here again i can say i do suspect on updated jars versions conflicts.