Closing the Result Set and Statement Objects


You must explicitly close the 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 your ResultSet 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.

For example, if your 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.





      A cat in gloves catches no mice.