tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anjib Mulepati <anji...@hotmail.com>
Subject Re: DB Connection error
Date Mon, 09 Jan 2012 15:21:42 GMT
I did change my config.xml to

<Context antiJARLocking="true" path="/myApp">
<Resource auth="Container"
             driverClassName="oracle.jdbc.driver.OracleDriver"
             maxActive="20"
             maxIdle="10"
             maxWait="-1"
             name="jdbc/myName"
             password="myPassword"
             testOnBorrow="true"
             type="javax.sql.DataSource"
             url="jdbc:oracle:thin:@//localhost:8080/MYDBS"
             username="myUsername"
             validationQuery="SELECT 1 FROM DUAL" />
</Context>

And this morning when DB restart I had to restart the tomcat to get 
connection. What can be other solutions?

On 1/3/2012 3:33 PM, Propes, Barry L wrote:
> 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


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


Mime
View raw message