I am trying to enable c3p0 (with MySQL) using hibernate.cfg.xml. However it doesn't
appear to be working in that my database connection always dies overnight. Two questions:
1) Is there any simple way to determine if I am actually using c3p0 at all? I've tried
grepping for "c3p0" in tomcat/logs, but that returns no matches.
2) Am I missing anything in my (anonymised) hibernate.cfg.xml, shown below?
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- configuration pool via c3p0-->
<property name="connection.provider_class">
org.hibernate.connection.C3P0ConnectionProvider
</property>
<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.idle_test_period">100</property> <!-- seconds -->
<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">100</property>
<property name="connection.url">jdbc:mysql://localhost:3306/???</property>
<property name="connection.username">???</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.password">????????</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<!-- thread is the short name for
org.hibernate.context.ThreadLocalSessionContext
and let Hibernate bind the session automatically to the thread
-->
<property name="current_session_context_class">thread</property>
<!-- this will show us all sql statements -->
<property name="hibernate.show_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<!-- mapping files -->
<!-- <mapping resource="/Mappings.hbm.xml" /> -->
<mapping resource="org/??????????????????/registry/hibernate/Mappings.hbm.xml"/>
</session-factory>
</hibernate-configuration>
|