Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Close Statement and ResultSet

233422Mar 7 2002
Does Oracle JDBC driver closes ResultSet when I call close method of Statement instance?

Here is in JDK1.3 API doc:
Note: A Statement object is automatically closed when it is garbage collected. When a Statement object is closed, its current ResultSet object, if one exists, is also closed.

In Oracle JDBC document:
The Oracle JDBC drivers do not have finalizer methods; they
perform cleanup routines by using the close() method of the ResultSet and
Statement classes. If you do not explicitly close your result set and statement
objects, serious memory leaks could occur. You could also run out of cursors in the
database. Closing a result set or statement releases the corresponding cursor in the
database.

Question is whether close() of Statement calls close() of ResultSet.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 13 2002
Added on Mar 7 2002
2 comments
438 views