Closing Objects when Not In Use
When you work with objects of Microsoft SQL Server JDBC Driver, particularly the SQLServerResultSet or one of the Statement objects such as SQLServerStatement, SQLServerPreparedStatement or SQLServerCallableStatement, you should explicitly close them by using their close methods when they are no longer needed. This improves performance by freeing up driver and server resources as soon as possible, instead of waiting for the Java Virtual Machine garbage collector to do it for you.
Closing objects is particularly crucial to maintaining good concurrency on the server when you are using scroll locks. Scroll locks in the last accessed fetch buffer are held until the result set is closed. Similarly, statement prepared handles are held until the statement is closed. If you are reusing a connection for multiple statements, closing the statements before you let them go out of scope will allow the server to clean up the prepared handles earlier.