Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to check closed CallableStatement in JDK 5 like isClosed() method in JDK 6

 
Sunil Chavan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

How to check CallableStatement is closed or not in JDK 5.

We can do the same using isClosed() or isPoolable() method in JDK 6.

Thanks & regards,

Sunil Chavan
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No method for that in Java 5, I'm afraid.

However, I've never needed it, and I use pure JDBC a lot. I always close the statements and resultsets in the same method I've opened them, in the finally block. In case where some code paths do not open the statement, I simply assign null to the variable, which indicates it was not opened and therefore shouldn't be closed.
 
Sunil Chavan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Martin for your reply.

I also couldn't find any alternative for the same. As of now I am checking that CallableStatement with null instead of isClosed() for JDK 5 environment.

Thanks & regards,

Sunil Chavan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic