how to check that I am using c3p0 in hibernate?

c3p0, hibernate, java

Solution

You are missing this line:

<property name="connection.provider_class"  
   value="org.hibernate.connection.C3P0ConnectionProvider"/>

This tells Hibernate to use the C3P0 connection pool.

Problem

I am change my hibernate.cfg.xml added new options: ``` <property name="connection.driver_class">org.postgresql.Driver</property> <property name="show_sql">true</property> <property name="connection.url">jdbc:postgresql://localhost:5432/pirates</property> <property name="connection.username">postgres</property> <property name="connection.password">mmm888</property> <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property> <property name="show_sql">false</property> <property name="hbm2ddl.auto">update</property> <property name="current_session_context_class">thread</property> <property name="hibernate.c3p0.min_size">5</property> <property name="hibernate.c3p0.max_size">200</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.generate_statistics">true</property> ``` and added hibernate-c3p0-4.1.4.Final.yar in my project, but I'm not sure that I'm using c3p0. I can set hibernate.c3p0.max_size = 2 but Hibernate continues to create 400 ( 400 -for example) threads - if it needs to. how to check that I am using c3p0 in hibernate ?

Original source