tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Tomcat 6.X and MySQL connection pooling issue
Date Thu, 01 Oct 2009 21:34:49 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin,

On 10/1/2009 12:53 PM, MartinOShea wrote:
>     private static DataSource dataSource = null;

I wouldn't recommend caching the DataSource object. This limits your
ability to reconfigure the DataSource on the fly if you want to. Local
JNDI lookups are super fast, so caching doesn't really save you that
much time.

> This should be read in tandem with the code I posted yesterday illustrating
> a typical database operation.
> 
> How do I switch query logging on though?

On the server:
http://dev.mysql.com/doc/refman/5.0/en/query-log.html

On the client:
http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html

(Look for the profileSQL setting).

Note that, if you are using DBCP's reconnection capabilities, it's not
necessary to set autoReconnect=true in the connection string (you'll
just end up creating 2 new connections when your connection is dropped,
though the first one will end up being destroyed pretty quickly).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrFIHkACgkQ9CaO5/Lv0PDUcwCfW1Wz6ieZ0pEnm/p+dm9vsiVo
IFIAoIlQSxys4cHzVi+YAro3BDrV0dju
=Ojns
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message