Re: Debugging my Connector/J based Tomcat Servlet

Ronald Klop <[email protected]> Sun, 12 Jul 2009 23:06:01 +0200 (CEST)
Newsgroups gmane.comp.db.mysql.java
Message-ID <1002391801.61311.1247432761449.JavaMail.tomcat@localhost>


Op zondag, 12 juli 2009 11:40 schreef Niklas Saers <[email protected]>:
> 
> On Jul 10, 2009, at 8:12 PM, Christopher G. Stach II wrote:
> > That's not the best practice.  The servlet lifecycle methods init  
> > and destroy don't happen before and after every request and  
> > connection data (ResultSet, etc.) is tied to the connection.  If you  
> > are holding the same connection open for the entire lifetime of the  
> > servlet, across many requests, you will still have that data  
> > lingering.  What you want is a construct like this:
> 
>  From the code I've inherited it looks like the choice to keep the  
> connection was to reduce the overhead with establishing the  
> connection. I agree very much with your suggestion and will implement  
> that, but do you know what overhead I'm looking at for opening and  
> closing these connections when getting them from a pool?
> 
> Cheers
> 
>     Nik
>  


Hi, I'm told in the past that opening and closing of connections with mysql is quite fast (compared to other databases). So depending on the load of your application you might give it a try without a pool. Make it work correctly in a simple way before adding complexity.

Ronald.