commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <>
Subject Re: Questions on DBCP Config
Date Sun, 14 Dec 2003 12:11:21 GMT
Hi Michael,
see inline

Holly, Michael wrote:
> Hi
> I'm using JDK 1.4.1_06  on Solaris 9.  My application is run on Tomcat
> 4.1.24 and makes connections to a MySQL 3.23.53 db and an Oracle 8i DB
> via the DBCP 1.0. 
> I have had excellent performanace using DBCP but on this project I am
> hitting a snag.  I use the following configuration for my oracle DB
> connection pool.

config removed

> My problem is that there is a firewall between the DB and my tomcat
> server.  On the production system firewall connections have 60 min TTL.
> Right now when I come in the morning and run the page that performs the
> query to the Oracle DB it hangs. Eventually, the page times out.  
> My questions are:
> 1. Can I utilize a 'testOnBorrow' parameter and a 'testWhileIdle'
> parameter at the same time?
yes, you can combine multiple test* parameters

> 2. Will utitlizing the 'testWhileIdle' and a
> 'timeBetweenEvictionRunsMillis' = 600000 (10min) and a
> 'minEvictableIdleTimeMillis' = 1800000 (30 min) solve my problem?
The testWhileIdle alone will solve your problem, the firewall sees the 
test query and will not close the connection.  The 
minEvictableIdleTimeMillis is optional but you have to configure 
timeBetweenEvictionRunsMillis and numTestsPerEvictionRun.

> 3. Could I set the 'MaxIdle' parameter down to 0 so that all connections
> are eventually dropped from inactivity?
It you set maxIdle=0 then no connection will be allowed to remain idle 
  in the pool. (idle meaning not active, not being used by the 
application). This effectively disables the pooling as all connections 
are closed immediately.

There is also another solution.
You can prevent that your firewall from dropping the connection using 
a oracle technique.
SQL*Net has a parameter which defines time interval to send a probe 
message to identify if the client process is still alive
- SQLNET.EXPIRE_TIME, sqlnet.ora file on the server side. 
SQLNET.EXPIRE_TIME = <your_value>
Set it to something like 30 when your firewall drops connection after 
60 minutes.

We use this in our server environment and it works perfectly.

-- Dirk

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message