7 messages in com.mysql.lists.javaRe: Closing Statements and ResultSets
FromSent OnAttachments
Ken Bloom12 Feb 2006 08:16 
David Rabinowitz12 Feb 2006 09:13 
Robert DiFalco12 Feb 2006 09:16 
Christopher G. Stach II12 Feb 2006 15:08 
Mark Matthews12 Feb 2006 19:10 
Ken Bloom12 Feb 2006 20:33 
Clayburn Juniel13 Feb 2006 06:29 
Subject:Re: Closing Statements and ResultSets
From:Christopher G. Stach II (cg@ldsys.net)
Date:02/12/2006 03:08:36 PM
List:com.mysql.lists.java

Ken Bloom wrote:

I have noticed that Connector/J 3.1.x is very strict about making sure to close all of your Statements and ResultSets. If you don't close them, the consequence is a leak of memory and of database resources.

I would argue that it's not the driver's business to know about this, nor is it its function. Some connection pools (Resin, Tomcat/DBCP, Primrose) will do this for you, however. If you are doing this in the web tier, you can just have a servlet request listener do this checking for you. If you are not, just close them! If you need help finding these in a large source tree, there are tools like PMD and FindBugs to do the hunting for you. It's probably a good idea to use them, anyway.