permaculture playing cards*
The moose likes JDBC and the fly likes Statement, ResultSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Statement, ResultSet" Watch "Statement, ResultSet" New topic
Author

Statement, ResultSet

Manuel Paco
Ranch Hand

Joined: Sep 23, 2001
Posts: 58
Do I have to close both Statement and ResultSet
or closing Statement will do?
Sam Moran
Ranch Hand

Joined: Sep 28, 2002
Posts: 86
The reading that I have done on Sun's website shows only closing the connection:

I hope this helps!


We make a living by what we get, we make a life by what we give!
Thomas Hubschman
Ranch Hand

Joined: Sep 25, 2002
Posts: 88
Manuel,
The API reads as follows:

java.sql
public interface ResultSet

public void close() throws SQLException

Releases this ResultSet object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.
Note: A ResultSet object is automatically closed by the Statement object that generated it when that Statement object is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results. A ResultSet object is also automatically closed when it is garbage collected.
Throws:
SQLException - if a database access error occurs
[ December 07, 2002: Message edited by: Thomas Hubschman ]

SCJP '02, SCWCD '02, SCJD '08, SCSNB '09, SCEA '10
 
 
subject: Statement, ResultSet
 
Similar Threads
Paging retrieve data question
Problem in running one resultset into another
maximum open cursor ... please help
too many open cursors
Visibility of Implicit Objects