I just wanted to update this, although I've kind of dropped this for awhile...
LoginTimeout doesn't help - I did set a LoginTimeout successfully, but that only works when creating the pool. I guess what we really need is a QueryTimeout. If the query is not returned within x seconds, throw an exception. So how would be the best way to impliment a QueryTimeout? Since we have about 50 existing web applications, I'm hoping it isn't something that has to be written in the application, but something that can go into server.xml and let Tomcat or commons-dbcp manage. Thanks, Phil On Tue, 21 Sep 2004 11:38:52 -0500, Phil Buescher <[EMAIL PROTECTED]> wrote: > On our Tomcat 4.1.29 and Tomcat 5.0 servers, we're using commons-dbcp 1.1. > > When a database fails, (locks up, unreachable), Tomcat will attempt to > use a pooled connection and hang. We don't receive an exception > within our code indicating the database failure. > > What we're hoping for is some kind of database connection timeout. > maxWait does not seem to do the trick, and setLoginTimeout doesn't > seem to work at all. We've crawled newsgroups and websites for a few > days now trying to find a fix. > > The problem is that when a database goes down, Tomcat will continue to > accept requests, and continue to attempt to pull data back from the > database until Tomcat finally hangs, effectively getting DoSed. > > Here's a copy of the server.xml params... > > <Resource auth="Container" name="jdbc/phonesearch" > scope="Shareable" type="javax.sql.DataSource"/> > <ResourceParams name="jdbc/phonesearch"> > <parameter> > <name>url</name> > > <value>jdbc:microsoft:sqlserver://AFNBLDDEV1.afni.net:1433;databaseName=PhoneSearch</value> > </parameter> > <parameter> > <name>validationQuery</name> > <value>select getdate()</value> > </parameter> > <parameter> > <name>maxIdle</name> > <value>30</value> > </parameter> > <parameter> > <name>maxActive</name> > <value>100</value> > </parameter> > <parameter> > <name>driverClassName</name> > <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value> > </parameter> > <parameter> > <name>maxWait</name> > <value>15000</value> > </parameter> > <parameter> > <name>removeAbandoned</name> > <value>true</value> > </parameter> > <parameter> > <name>factory</name> > <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> > </parameter> > <parameter> > <name>username</name> > <value>PHONESEARCHUSER</value> > </parameter> > <parameter> > <name>removeAbandonedTimeout</name> > <value>60</value> > </parameter> > <parameter> > <name>password</name> > <value>**********</value> > </parameter> > </ResourceParams> > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
