Hibernate - c3p0 unable to reconnect to database
843859Feb 2 2006 — edited Nov 20 2014Hello All,
I am having a problem with my apps reconnecting to the database after it has timed out. For now I have just increased the mysql time out variable to some ridiculous number just to get me by. Below is what I have specified for hibernate and c3p0 connection pool but does not work.
<property name="connection.username"></property>
<property name="connection.url">jdbc:mysql://path:3306/database?autoReconnect=true</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.password"></property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.autoReconnect">true</property>
<property name="connection.autoReconnectForPools">true</property>
<property name="connection.is-connection-validation-required">true</property>
<property name="c3p0.max_size">10</property>
<property name="c3p0.min_size">2</property>
<property name="c3p0.timeout">0</property>
<property name="c3p0.max_statements">50</property>
<property name="c3p0.idle_test_period">300</property>
<property name="c3p0.acquire_increment">2</property>
<property name="connection.autoReconnect">true</property>
<property name="connection.autoReconnectForPools">true</property>
<property name="connection.is-connection-validation-required">true</property>
<property name="c3p0.validate">false</property>
Hibernate version: 2.1.8
Name and version of the database I am using: MYSQL 4.1
I have tried looking up various solutions on the internet and the only thing I have found is if you try using JNDI but then you have to make changes to tomcat, hibernate and all this other stuff. Isn't there an easier solution to just have your app reconnect to the database?
Any help with this would be really appreciated becuase I am out of options.