File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to check if the state of resultset is closed or not.

 
Satish Kota
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Please tell me if there is any function to know if the state of a resultset is closed or not. I want to perform the following operation.

if( ! <function that returns true if the resultset is closed> )
rs.close();

Thanks to all in advance.
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think if there is any such method which would tell you if it is closed or not, rather you should close the resultset in finally block of code




Shailesh
 
Paul Clapham
Sheriff
Pie
Posts: 20171
25
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then you just call rs.close() and catch any SQLExceptions that might occur. You have to catch them anyway, even if you know the ResultSet is not closed yet.

However you really should reorganize your code, as Shailesh says, so there is no question whether it is closed or not.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic