Hello everybody,
I'm trying to solve the reconnection problem with MySQL server when the wait_timeout for the database connections expires.
I'm using c3p0 to manage the pool of db connections, and I have configure Hibernate as follows (excerpt of the hibernate_cfg.xml file)
Code:
<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.idle_test_period">1</property>
<property name="hibernate.c3p0.max_size">100</property>
<property name="hibernate.c3p0.max_statements">0</property>
<property name="hibernate.c3p0.min_size">10</property>
<property name="hibernate.c3p0.timeout">1000</property>
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
Plus I have created the c3p0.properties file and placed in the root package (which is directly included in the classpath). The properties file contains:
Code:
# c3p0.properties
c3p0.testConnectionOnCheckout=true
c3p0.testConnectionOnCheckin=true
c3p0.automaticTestTable=true
c3p0.trace=true
c3p0.debug=true
Apparently, it seems everything it should be done to address the event of broken db connection, but I still get a connection time out error when connecting to the db after the time out.
I must also mention that, after trying once - and getting the related error - the successful trial in the connection to the database goes through without any error.
Anybody could suggest where I should look into exactly? Or any ideas about this problem?
Many thanks,
Dan