• Register

Share:- Whatsapp Facebook Facebook

------------------------------------- Welcome to Developerhelpway Q&A, where you can ask questions and receive answers from other members of the community.


0 votes
How to configure hibernate connection pool ?
in Hibernate by

1 Answer

0 votes

Open your hibernate.cfg.xml file and paste the following code:

<property name="hibernate.c3p0.min_size">1</property>
<property name="hibernate.c3p0.max_size">5</property>
<property name="hibernate.c3p0.timeout">300</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.idle_test_period">3000</property>
<property name="hibernate.c3p0.acquire_increment">2</property>

hibernate.c3p0.min_size:– Minimum number of JDBC connections in the pool. Hibernate default: 1
hibernate.c3p0.max_size:– Maximum number of JDBC connections in the pool. Hibernate default: 100
hibernate.c3p0.timeout:– When an idle connection is removed from the pool (in second). Hibernate default: 0, never expire.
hibernate.c3p0.max_statements:– Number of prepared statements will be cached. Increase performance. Hibernate default: 0 , caching is disable.
hibernate.c3p0.idle_test_period:– Idle time in seconds before a connection is automatically validated. Hibernate default: 0