-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Robert,
Robert Jacobson wrote: | I was authenticating using a mysql database through the JDBCRealm. I | found some posts in the archives ( | http://www.mail-archive.com/[EMAIL PROTECTED]/msg149130.html) | indicating that switching from the JDBCRealm to DataSourceRealm would | resolve the issue, so I have done so. Yes, using DataSourceRealm is the preferred configuration. | In the process I also added the | autoReconnect parameter to the connection URL (i.e. | jdbc:mysql://localhost:3325/authority?autoReconnect=true ) You should remove this parameter. It has been deprecated in favor of other strategies (see below) for years and years, now (it even says so in the documentation for Connector/J). By the way, there's no reason not to upgrade to the most recent Connector/J, either. I don't believe there are any JDK or Tomcat issues -- although some things have changed such as the object types returned by ResultSet.getObject() for certain column data types and the return value (null versus Exception thrown) for all-zero values in DATE, DATETIME, and TIMESTAMP column data types. | I have authentication working with the new configuration. However, | after a mysql connection timeout, the first attempt to authenticate | always fails. The second attempt is successful. | | Is there a way to fix this problem? Yes. You should use the validationQuery attribute on your <Resource> element. Set it to something that should always succeed. Most MySQL users use "SELECT 1" as the simplest possible query. Setting this attribute to "SELECT 1" will cause the connection pool to test the connection before handing it over to the Realm for authentication. If the connection is stale, another connection will be chosen (and so on, until a non-stale connection is found). Stale connections will be closed and new ones opened in their places. This is /much/ preferred to using autoReconnect=true, which always results in the behavior you are experiencing. Hope that helps, - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkgMyOAACgkQ9CaO5/Lv0PCRSACfRRlVNk83wOA9iWwz8e24UKU1 RDoAn13KrgCfseodnnRmNQZJeVclNEUA =S6gp -----END PGP SIGNATURE----- --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]