Chris, based on what you're saying and the server.xml posted earlier in this thread, the following should be done?
1. Remove the JDBCRelm from the Engine node 2. Create a GlobalNamingResources Resource entry with the following: <Resource name="jdbc/auth" description="The Jar Bar user authentication" type="javax.sql.DataSource" auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="10" maxIdle="3" maxWait="10000" password="MyPassword" url="jdbc:mysql://localhost:3306/yucca123_thejarbar" validationQuery="/* ping */ SELECT 1" username="MyUser"/> This is basically what I would normally put in the context.xml file of a web application for an application-specific database connection. 3. Then create a DataSource Realm under the Engine node to replace JDBCRealm. <Realm className="org.apache.catalina.realm.DataSourceRealm" userTable="users" userNameCol="user_name" userCredCol="user_pass" userRoleTable="user_roles" roleNameCol="role_name" dataSourceName="jdbc/auth"> It was a little unclear to me from the documentation that I could put all of the resource attributes in a GlobalNamingResources Resource entry. It was also a little unclear to me that I could just refer to a global resource name with dataSourceName in the Realm. Thanks for clearing that up. . . . just my two cents /mde/ --- On Tue, 6/1/10, Christopher Schultz <ch...@christopherschultz.net> wrote: > From: Christopher Schultz <ch...@christopherschultz.net> > Subject: Re: problems at thejarbar.org > To: "Tomcat Users List" <users@tomcat.apache.org> > Date: Tuesday, June 1, 2010, 7:14 AM > -----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. > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org