tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: first authentication attempt fails - mysql timeout
Date Mon, 21 Apr 2008 17:20:19 GMT
The DatasourceRealm will work.  Drop the autoReconnect parameter from 
the database url though as it's not recommended by the MySQL folks.  
Instead, add a validationQuery to your ResourceParams so database 
connections are tested briefly before they are borrowed from the pool.  
The query can be as simple as 'select 1'.  Also if the Resource you are 
trying to use with the Datasource realm is not a global resource, you'll 
probably need to add localDataSource="true" to the <Realm ... /> definition.

See the docs at 
http://tomcat.apache.org/tomcat-4.1-doc/realm-howto.html#DataSourceRealm 
and 
http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html

Info regarding autoReconnect can be found at 
http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html

(version 5.0 -- you didn't specify mysql version)

-David

Robert Jacobson wrote:
>
> Hi,
>
> I have an existing Tomcat configuration that is working well.  
> However, it is running version 4.1.31.  We are updating the platform, 
> so I thought I'd take the opportunity to update Tomcat.  Unfortunately 
> (??) I must stick with the Tomcat 4.1 release.
>
> I have a test machine on which I have installed 4.1.37.  I only had 
> one issue with the upgrade -- the authentication was not working quite 
> as well as it was before.  While it worked, I had one issue -- when 
> the mysql connection would timeout (after 8 hours by default), the 
> authentication would stop working completely.  With tomcat 4.1.31, 
> there would be an exception w/ stack trace, but it would reconnect and 
> work right away.
>
> I was authenticating using a mysql database through the JDBCRealm.  I 
> found some posts in the archives ( 
> http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg149130.html) 
> indicating that switching from the JDBCRealm to DataSourceRealm would 
> resolve the issue, so I have done so.  In the process I also added the 
> autoReconnect parameter to the  connection URL (i.e. 
> jdbc:mysql://localhost:3325/authority?autoReconnect=true )
>
> I suppose I should note that my configuration is now essentially 
> straight out of the JNDI datasource HOWTO.  I of course changed the 
> username & password, the port number, and the database name.
>
> 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?
>
> Thanks for your time.
>


-- 
David Smith
Network Operations Supervisor
Department of Entomology
Cornell University
2132 Comstock Hall
Ithaca, NY 14853
Phone: (607) 255-9571
Fax: (607) 255-0940


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


Mime
View raw message