Fixing dropped JDBC connections between Hibernate and MySQL
I have been trying to debug a case where my Hibernate connection to MySQL kept dropping every 8 hours or so. Very difficult to debug because you have to wait around 8 hours to see if your fix worked or not. Turns out that the default connection pooling provided by Hibernate is very basic, and not recommended for anything "production".
Here is an article that was very helpful to me to solve this problem - http://michaelstudman.com/fullfathomfive/articles/2004/06/07/mysql-dropp....
I ended up using a connection pool provided by C3P0, and everything seems to be working fine. You can google c3p0 and hibernate to look at a typical hibernate config. My XML config looks like this -
<!-- configuration pool via c3p0-->
<property name="c3p0.acquire_increment">1</property>
<property name="c3p0.idle_test_period">100</property> <!-- seconds -->
<property name="c3p0.max_size">100</property>
<property name="c3p0.max_statements">0</property>
<property name="c3p0.min_size">10</property>
<property name="c3p0.timeout">100</property> <!-- seconds -->
Cheers,
Sriram
