Re: Debugging my Connector/J based Tomcat Servlet
Niklas Saers <[email protected]> Sun, 12 Jul 2009 11:40:34 +0200
| Newsgroups | gmane.comp.db.mysql.java |
|---|---|
| Message-ID | <[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 -- MySQL Java Mailing List For list archives: http://lists.mysql.com/java To unsubscribe: http://lists.mysql.com/[email protected]