配置数据库连接池
配置C3P0连接池。
先导入c3p0包。
然后在hibernate.cfg.xml文件中 ,使用下面代码配置连接池
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
可以通过下面的属性来配置连接池的参数
#hibernate.c3p0.max_size 2
#hibernate.c3p0.min_size 2
#hibernate.c3p0.timeout 5000
#hibernate.c3p0.max_statements 100
#hibernate.c3p0.idle_test_period 3000
#hibernate.c3p0.acquire_increment 2
#hibernate.c3p0.validate false
例如: <property name="hibernate.c3p0.max_size">5</property>