tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Propes, Barry L " <barry.l.pro...@citi.com>
Subject RE: DB Connection error
Date Tue, 03 Jan 2012 20:33:04 GMT
I also have the following attributes in mine, for what it's worth.

    maxIdle="30"
    maxWait="10000"
    maxActive="10"
    testOnBorrow="true"
    timeBetweenEvictionRunsMillis="-1"
    minEvictableIdleTimeMillis="28800"
    poolPreparedStatements="true"
    removeAbandoned="true"
    removeAbandonedTimeout="300"
    logAbandoned="false"

-----Original Message-----
From: Daniel Mikusa [mailto:dmikusa@vmware.com] 
Sent: Tuesday, January 03, 2012 1:10 PM
To: Tomcat Users List
Subject: Re: DB Connection error

On Tue, 2012-01-03 at 10:47 -0800, Chema wrote:
> > But in my application I have context.xml with following
> >
> > <Context antiJARLocking="true" path="/myApp">
> > <Resource auth="Container"
> >            driverClassName="oracle.jdbc.driver.OracleDriver"
> >            maxActive="20"
> >            maxIdle="10"
> >            maxWait="-1"
> >            name="jdbc/myName"
> >            password="myPassword"
> >            type="javax.sql.DataSource"
> >            url="jdbc:oracle:thin:@//localhost:8080/MYDBS"
> >            username="myUsername"
> >             />
> > </Context>
> 
> Well, you can use validationQuery parameter with "SELECT 1 FROM
> DUAL;". 

+1

Try adding validationQuery="SELECT 1 FROM DUAL" and testOnBorrow="true".

When you restart the DB, it's going to disconnect all of the connections
in your pool.  If you add a validation query and one of the "testOn*"
options (testOnBorrow is my personal favorite) then the pool will catch
the bad connections, remove them and assuming your DB is back online,
create new ones.

Dan
Mime
View raw message