Slide 12.9: Processing the result set Slide 12.11: Committing changes Home |
ResultSet
and Statement
objects after you finish using them.
This applies to all ResultSet
and Statement
objects you create when using the Oracle JDBC drivers.
The drivers do not have finalizer methods; cleanup routines are performed by the close( )
method of the ResultSet
and Statement
classes.
If you do not explicitly close yourClosing a result set or statement releases the corresponding cursor in the database.ResultSet
andStatement
objects, serious memory leaks could occur. You could also run out of cursors in the database.
ResultSet
object is rset
and your Statement
object is stmt
, close the result set and statement with these lines:
rset.close( ); stmt.close( );When you close a
Statement
object that a given Connection
object creates, the connection itself remains open.