Hi Paul,

I don't have experience with this pool, but I have experienced this
disconnection problem with mysql. Got around it using the mysql parameter
autoReconnect=true. I would suggest trying either of the following:

 <parameter>
       <name>autoReconnect</name>
       <value>true</value>
    </parameter>

or

    <parameter>
      <name>url</name>
      <value>jdbc:mysql://localhost:3306/javatest?autoReconnect=true</value>
    </parameter>

If one is successful, please report back so that we know if it worked for
you or not.


Regards,

--Jay Gardner

-----Original Message-----
From: Paul Phillips [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 26, 2002 10:04 PM
To: Tomcat Users List
Subject: sweeping stale connections - Commons DBCP and Tomcat 4.1.9

I'm using Tomcat 4.1.9.  I have been having a problem with the DBCP jdbc
connection pool when used with MySQL.  Apparently MySQL kills off stale
connections after an 8 hour period.  According to Mark Matthews (developer
of the jdbc-mysql driver), I need to configure the pool to sweep out the
stale connections, and initiate new ones.

I have looked and looked in vain for documentation for DBCP that would
explain how to set the configuration in my Tomcat server.xml file (using
JNDI) that would enable this.  I can't find anything.  I've tried examining
the source of DBCP, but I'm afraid that I can't figure it out.

My Tomcat server.xml file uses this configuration below, which is right out
of:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-ho
wto.html

>From what I can tell, there are other parameters that  I can enter to force
the sweeping of stale connections.  However, I don't know what they are, or
how to use them.  If anyone can give me an example of the correct syntax
here, I would be very grateful, ( since my webapp dies every night, due to
this problem!)

Thanks --

Paul Phillips

(excerpt of server.xml...)

<Context path="/DBTest" docBase="DBTest"
        debug="5" reloadable="true" crossContext="true">

  <Logger className="org.apache.catalina.logger.FileLogger"
             prefix="localhost_DBTest_log." suffix=".txt"
             timestamp="true"/>

  <Resource name="jdbc/TestDB"
               auth="Container"
               type="javax.sql.DataSource"/>

  <ResourceParams name="jdbc/TestDB">
    <parameter>
      <name>factory</name>
      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <parameter>
      <name>maxActive</name>
      <value>100</value>
    </parameter>
    <parameter>
      <name>maxIdle</name>
      <value>30000</value>
    </parameter>
    <parameter>
      <name>maxWait</name>
      <value>100</value>
    </parameter>
    <parameter>
     <name>username</name>
     <value>javauser</value>
    </parameter>
    <parameter>
     <name>password</name>
     <value>javadude</value>
    </parameter>

    <parameter>
       <name>driverClassName</name>
       <value>org.gjt.mm.mysql.Driver</value>
    </parameter>

    <parameter>
      <name>url</name>
      <value>jdbc:mysql://localhost:3306/javatest</value>
    </parameter>
  </ResourceParams>
</Context>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to