Yes I defined the test query as well but it didn't fix the pb
The issue was fixed with the maxConnectionAge parameter

The exception was : 

# com.mysql.jdbc.CommunicationsException: Communications link failure due to 
underlying exception:

#

# ** BEGIN NESTED EXCEPTION **

#

# java.net.SocketException

# MESSAGE: Software caused connection abort: recv failed

#

# STACKTRACE:

#

# java.net.SocketException: Software caused connection abort: recv failed

# at java.net.SocketInputStream.socketRead0(Native Method)

# at java.net.SocketInputStream.read(Unknown Source)

My first config with c3p0 was :

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">

   <property name="driverClass"
 value="com.mysql.jdbc.Driver" />

   <property name="jdbcUrl" 
value="jdbc:mysql://localhost:3306/mydb?relaxAutoCommit=true&amp;autoReconnect=true"
 />

   <property name="user" value="user" />

   <property name="password" value="0000" />

   <property name="initialPoolSize" value="5" />

   <property name="minPoolSize" value="5" />

   <property name="maxPoolSize" value="20" />

   <property name="checkoutTimeout" value="1000"/>

   <property name="acquireIncrement" value="1"/>

   <property name="testConnectionOnCheckin" value="true"/>

   <property name="testConnectionOnCheckout" value="true"/>

   <property name="preferredTestQuery" value="SELECT 1"/>

   <property name="idleConnectionTestPeriod"
 value="60"/>

</bean>

and now I added 

<property name="maxConnectionAge"
 value="3600"/>

--- En date de : Mer 16.9.09, Gaurav Lohiya <gloh...@gmail.com> a écrit :

De: Gaurav Lohiya <gloh...@gmail.com>
Objet: Re: Re : Connection Closed Issue
À: "Tomcat Users List" <users@tomcat.apache.org>
Date: Mercredi 16 Septembre 2009, 17h21

Do you have the validation query specified. I believe putting in the
validation query should solve the problem.

On Wed, Sep 16, 2009 at 11:17 AM, Chetouani <kchet...@yahoo.fr> wrote:

> Hi,
>
> I had a similar problem.
> I was using tomcat and mysql and configured a connection pool using dbcp.
> The problem was that after some hours the application starts to throw an
> exception.
> The exception was : communication link failure
>
> The reason is that mysql is destroying the connectionz after some time (8
> hours by default)
> and the connection pool is not aware of that
>
> I replaced dbcp by c3p0 and defined the maxConnectionAge to 3600s and the
> problem was solved
>
>
> --- En date de : Mer 16.9.09, Sharath Babu S S S <sharath.b...@solix.com>
> a écrit :
>
> De: Sharath Babu S S S <sharath.b...@solix.com>
> Objet: Connection Closed Issue
> À: users@tomcat.apache.org
> Date: Mercredi 16 Septembre 2009, 11h52
>
> Hi all,
>
> we are using Tomcat server 5.5.20. Database is 9.0.28.
> After starting tomcat and using our application after sometime we are
> getting the following error:
>
> Can anyone suggest me, its really very urgent
>
> Thread 78: SQLException While Purging the Selected Data From Source Table
> java.sql.SQLException: Connection
>
> oracle.jdbc.driver.t4cconnect...@1c9e95a is closed. for CONFIG 100019 For
> RUN_ID 100063
>
> Debug: AJArchiveLogDetails.java Exception Occured While Inserting Data to
> AJArchiveLogDetails java.sql.SQLException: Connection oracle.jdbc.dr
>
> iver.t4cconnect...@1c9e95a is closed.
>
>     Debug: insertToAJArchiveLogDetails()
>
> java.sql.SQLException: Connection oracle.jdbc.driver.t4cconnect...@1c9e95ais 
> closed.
>
>         at
> org.apache.tomcat.dbcp.dbcp.DelegatingConnection.checkOpen(DelegatingConnection.java:354)
>
>         at
> org.apache.tomcat.dbcp.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:246)
>
>         at
> org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:302)
>
>         at
> beans.AJArchiveLogDetails.insertToAJArchiveLogDetails(AJArchiveLogDetails.java:177)
>
>         at beans.PurgeProcess_T.run(PurgeProcess_T.java:281)
>
> Debug: PurgeProcess_T.java: run() Thread 78: Exception While Updating the
> AJ_JOBS Table java.lang.Exception: java.sql.SQLException: Connection
>
>  oracle.jdbc.driver.t4cconnect...@1c9e95a is closed. for CONFIG 100019 For
> RUN_ID 100063
>
> Debug: PurgeProcess_T.java: run() Thread 78: Exception Releasing Resources
> java.sql.SQLException: Connection oracle.jdbc.driver.T4CConnection@
>
> 1c9e95a is closed. for CONFIG 100019 For RUN_ID 100063
>
>
> With Regards............
> Sharat Babu Shravanam
>
> --------------------------------------------------------------------
> Byte and Switch Names Solix Technologies
> One of the Top 10 Startups to Watch
>
> Read More at http://www.solix.com/top10startups
> ---------------------------------------------------------------------
>
>
>
>
>
>
>
> **************** CAUTION - Disclaimer *****************
>
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
> solely for the use of the addressee(s). If you are not the intended
> recipient, please notify the sender by e-mail and delete the original
> message. Further, you are not to copy, disclose, or distribute this
> e-mail or its contents to any other person and any such actions are
> unlawful. This e-mail may contain viruses. Solix has taken every
> reasonable precaution to minimize this risk, but is not liable for any
> damage you may sustain as a result of any virus in this e-mail. You
> should carry out your own virus checks before opening the e-mail or
> attachment. Solix reserves the right to monitor and review the content
> of all messages sent to or from this e-mail address. Messages sent to or
> from this e-mail address may be stored on the Solix e-mail system.
>
>
> ****End of Disclaimer **********************************
>
>
>
>
>
>
>




-- 
Regards
Lohiya Gaurav



      

Reply via email to