Re: Debugging my Connector/J based Tomcat Servlet

Niklas Saers <[email protected]> Fri, 10 Jul 2009 15:51:08 +0200
Newsgroups gmane.comp.db.mysql.java
Message-ID <[email protected]>
Hi again Roland, and thanks for your quick feedback,

On Jul 10, 2009, at 3:37 PM, Ronald Klop wrote:
> Maybe a silly question (I don't know your skills), but do you close  
> all the ResultSets, Statements and Connections properly in your  
> application after use? Or if you are using pooling is you pool  
> closing everything right?

All ResultSets are sent a .close() after they have been used.

I only use PreparedStatements, and they are committed after execution  
of updates and inserts.

The connection is initialized in the servlets init() function from the  
JDBC resource of type javax.sql.DataSource in the webapp config-file  
that defines the webapps context. It is closed in the destroy()  
function.

Apart from that there is no more disposing/deconstructing than what  
the garbage collector does, and I have a feeling there should be some  
as all these objects that have long expired their use stick around.

In the JDBC resource there are defined max 100 connections, and the  
mysql server will keep a connection live for 10 days if it has to.  
This has been set up before I got into the codebase, and I expect it  
can be relaxed. Is the JDBC resource what you mean by pool? How should  
it be set up to close everything right? At the moment, it seems that  
nothing closes, ever, except for the recordsets, and even there the  
fields stick around forever, probably as a part of the closed down but  
not garbage collected recordsets.

Cheers

	Nik

-- 
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe:    http://lists.mysql.com/[email protected]