Clean up connections before releasing them to the data source

Many JDBC programs do not explicitly clean up java.sql.Statement objects. Instead, they rely on the JDBC driver to clean up Statement objects when the connection is closed. This strategy does not work with pooled connections; you must explicitly clean up Statement objects before releasing a connection back into the pool. To clean up Statement objects, call Statement.close() and set the Statement reference to null.

WARNING! To prevent memory leaks, you must explicitly clean up a connection’s Statement objects before releasing the connection back into the pool. Do not release the same connection more than once.