0

I am using hibernate c3p0 with mysql database , my c3p0 config is below: 1

    <property name="hibernate.c3p0.idle_test_period">100</property>
        <property name="hibernate.c3p0.min_size">5</property>
        <property name="hibernate.c3p0.max_size">20</property>        
        <property name="hibernate.c3p0.max_statements">0</property>
        <property name="hibernate.c3p0.timeout">200</property>
<property name="hibernate.connection.provider_class">org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider</property>

it is working fine but problem arises when server stays idle for long time like 8-10 hours , tomcat not respond after that and there is no error log surprisingly from any side(mysql,hibernate,tomcat) it keeps me waiting for response (we are making httprequest to servlet) but do not throw any error, I cant see any error log on tomcat logs

so I am not sure if its the issue of c3p0 or mysql, anybody can help, much appreciated!!

1 Answers1

0

when the database is on a seperate box and there's a firewall in between which is set to timeout idle connections.

In some circumstances the firewall cuts off the connection in such a way that the JDBC end doesn't detect, and attempting to use it results in an indefinite block.

And if it is a custom connection pool which sent a test query down the connection before returning it from the pool. Configured this test query to have a timeout using 'Statement.setQueryTimeout' so that it didn't block indefinitely.

Anshul Sharma
  • 3,432
  • 1
  • 12
  • 17