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

when to close resultset

 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi-
I have a question re: resultsets...if a resultset obj goes out of scope, does it automatically close the rs? or is there a chance it could be left open?
We're suing IBM DB2 JDBC 2.0 drivers...
thanks,
Max Tomlinson
 
sandeep balyan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is always a good practise to close the result set as it can cause a exception some where in application.like null pointer exception .if u close statements than its okee as it does close resultset ..
try to do statement close in finally block to keep fair that even if u r program throws exception u r connection and statement is closed ..
that means resources r free
regds
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"balyan",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp.
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements.
Also, please try not to use contractions (u, r etc) since they often make it harder to understand posts.
Thanks.
Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic