-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Yucca Nel,
On 5/30/2010 1:53 PM, Yucca Nel wrote:
> Ok I need to keep connection open to avoid exceeption but have found
> this is deprecated ....
> autoReconnect=true
> can someone provide up to date strategy for dealing with this?
Don't use autoReconnect as a parameter to the JDBC driver. Instead, use
the "validationQuery" on the connection pool to have the pool verify
that the connection is still valid. MySQL Connector/J even supports a
"ping" query that can gracefully fall-back to driver versions that don't
support it.
I highly recommend that you:
1. Use a Tomcat-configured DataSource
2. Use a DataSourceRealm coupled with #1
3. Tell Hibernate to use #1
That way, all your db configuration is in one place.
Add this parameter to your DataSource configuration (it configures the
connection pool):
validationQuery="/* ping */ SELECT 1"
This will cause the connection pool to execute that query every time a
connection is requested from the pool, just to verify that it's properly
connected. Your web application should never get a dead connection and
therefore shouldn't have to deal with that situation.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkwFFcIACgkQ9CaO5/Lv0PDNJACggJuwEQRRqswYU9awTjda7bM8
/KAAnAuZSd1OPmqV94qEibWHXWMyTW6Y
=Rmml
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
|