Finalizing Objects

From InterBase

Go Up to Executing SQL Statements in InterClient Programs


Applications should explicitly close the various JDBC objects (Connection, Statement, and ResultSet) when they are done with them. The Java “garbage collector” may periodically close connections, but there's no guarantee when, where, or even if this will happen. It's better to immediately release a connection's database and JDBC resources rather than waiting for the garbage collector to release them automatically. The following close statements should appear at the end of the previous executeQuery() example.

resultSet.close();
statement.close();
connection.close();

Advance To: