Re: Debugging my Connector/J based Tomcat Servlet

Ronald Klop <[email protected]> Sat, 11 Jul 2009 10:44:17 +0200 (CEST)
Newsgroups gmane.comp.db.mysql.java
Message-ID <839770987.56581.1247301857019.JavaMail.tomcat@localhost>
Op vrijdag, 10 juli 2009 15:51 schreef Niklas Saers <[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
> 
>  

So you have 1 connection which you share with all http requests. Are you sure the Connection can be used mutli-threaded?

Ronald.