This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes ResultSet closing - regarding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "ResultSet closing - regarding" Watch "ResultSet closing - regarding" New topic
Author

ResultSet closing - regarding

PN Kumar
Ranch Hand

Joined: Sep 08, 2001
Posts: 38
I have a situation where in i need to use a set of queries, one after the other, to obtain data from different tables. Is it a must to close the statement and resultSet after each of the query?Won't the resultSet change with the statement(or the query)? Is there any specific advantage of closing the result set each time? The query output would be only one row for each of the queries.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8915
    
    8

It is good form to explicity close all of the JDBC objects when you are done with them. Close them in a "finally" block, so they get closed even in the event of an exception.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ResultSet closing - regarding