Meaningless Drivel is fun!
The moose likes JDBC and Relational Databases 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 and Relational Databases
Bookmark "ResultSet closing - regarding" Watch "ResultSet closing - regarding" New topic

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

Joined: Oct 29, 2001
Posts: 9137

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.

[How To Ask Questions On JavaRanch]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: ResultSet closing - regarding
jQuery in Action, 3rd edition