tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Mikusa <dmik...@vmware.com>
Subject Re: DB Connection error
Date Tue, 03 Jan 2012 19:10:13 GMT
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