commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Holly" <>
Subject RE: Broken Pipe error in DBCP when DB has been restarted.
Date Wed, 07 May 2003 17:58:51 GMT
I found out more info.

I implemented the validation query for the connection pool. This seemed to
work except I was getting huge intermittant delays on some queries.

My DBA went to work and found out that we are running Oracle with MTS. He
also found out that MTS has an error with the dispatcher process causing up
to 60+ second intermittant delays.  The solution was to set up the
connection pool to request a dedicated connection from Oracle.

Here is a copy of the config for the DBCP pool from my server.xml.

  <Resource name="jdbc/oracle_myco" auth="Container"

  <ResourceParams name="jdbc/oracle_myco">
      <!-- old style connect string -->
      <!-- new style connect string for dedicated connection -->
      <value>jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS_LIST = (ADDRESS =
      <value>select 'validationQuery' from dual</value>

Notice the odd look for the db url.  A entry on Oracle's metalink said that
to get a dedicated link you must copy your SID entry from the tnsnames.ora
file and add the entry (SERVER = DEDICATED) to get the connection.
Obviously, the oracle jdbc driver can handle this.

The other thing to look for is the addition of the

      <value>select 'validationQuery' from dual</value>

parameters for the DBCP pool.

For more info on what parameters are available see


Thanks for the help!


-----Original Message-----
From: Michael Holly []
Sent: Tuesday, May 06, 2003 12:08 PM
Subject: Broken Pipe error in DBCP when DB has been restarted.


I am running Tomcat 4.1.18, Oracle 8.1.7 using the thin driver, and Commons

My problem mainly stems from the fact that my company has a policy to reboot
the database server every night. I know, I know, Oracle on Sun should run

Anyway, I can't get around the policy. Perhaps someone here can help me get
around it.

Since the DB gets restarted, the connections that the pool has open become
invalid. My application gets a SQLException: IoException: Broken Pipe error
when ever I try access the JSP page in the morning. It is configured with
two connections and the page will error out twice before finally rendering.

I'm in the process of adding a validation query to my pool, but I am not
sure that this will help. See link for details

I'm not real happy about this validation query because it is just more
network traffic. I'm interseted in the 3rd option described in the snippet
below.  Can anyone point me how to configure my pool like this?



> Weblogic's JDBC pool has two options:
> 1. Validate on checkout
> 2. Validation on return
> You can select any or none of the options.  If you don't select any and
> the pooled connections go bad, then you'll get bad connections when
> checking out. I personally like validating the connection on checkout,
> although your code is then tied to a pool that does this.
> -Dave

Right, and DBCP does those two options, plus a third: validation while
idle, the periodically walks through the connections sitting idle in the
pool and evicts the ones that go bad.

Personally, I use the third option almost exclusively, attempting to
strike some balance between the validation overhead and the time it will
take the app to recover (i.e., purge the bad connections and establish new

It's really the same problem with or without pooling, sometimes your
connection will go bad.  Validation or failure detection can't prevent
this problem, it can only try to minimize it.  (For example, assume you've
got this magical "detect a dropped connection and quietly substitute a
valid one, at any point in the client code" facility.  It's still possible
for a connection to be dropped in the midst of a client transaction, and
there may be little the connection wrapper can do to make that problem
quietly go away.  Record and replay the executed statements?  How do you
know whether the exception-throwing statement made it to the database or


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

View raw message