When closing the connection with the back-end server, wont the result set and statement object be closed automatically? Or is explicit closing of statement and resultSet a preferred way of doing it?
Wayne L Johnson
posted 11 years ago
Explicit closing of the ResultSet and Statement is the preferred way to go. This let's the database server free its resources. If you close the Connection w/out closing the ResultSet, your Java resources are freed, but the database may still consider the ResultSet (cursor) to be open. I've seen this lead to a "Maximum number of cursors exceeded" error.