Configure Hibernate C3P0 Connection Pooling Configure Hibernate C3P0 Connection Pooling spring spring

Configure Hibernate C3P0 Connection Pooling


Mention these property in your hibernate.cfg.xml file

    <property name="hibernate.c3p0.acquire_increment">1</property>    <property name="hibernate.c3p0.idle_test_period">100</property>    <property name="hibernate.c3p0.max_size">10</property>    <property name="hibernate.c3p0.max_statements">10</property>    <property name="hibernate.c3p0.min_size">10</property>    <property name="hibernate.c3p0.timeout">100</property>

Refer this link for better understanding: Configuration Properties


In your applicationContext, instead of using <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" ... try using <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" ...The C3P0PooledDataSource will create a wrapped database connection using the specified DriverClassName, url, username and password