在hibernate.cfg.xml中添加c3p0配置。
<property name="hibernate.c3p0.max_size">10</property> 最大连接数
<property name="hibernate.c3p0.min_size">4</property> 最小连接数
<property name="hibernate.c3p0.acquire_increment">2</property> 一次增加多少连接数
<property name="hibernate.c3p0.timeout">5000</property> 连接多少时间没用就销毁
<property name="hibernate.c3p0.idle_test_period">5000</property> 检测线程多少时间检测一次连接以销毁没用的连接
<property name="hibernate.c3p0.max_statements">10</property> 缓存statement对象的数量
<property name="hibernate.c3p0.min_size">4</property> 最小连接数
<property name="hibernate.c3p0.acquire_increment">2</property> 一次增加多少连接数
<property name="hibernate.c3p0.timeout">5000</property> 连接多少时间没用就销毁
<property name="hibernate.c3p0.idle_test_period">5000</property> 检测线程多少时间检测一次连接以销毁没用的连接
<property name="hibernate.c3p0.max_statements">10</property> 缓存statement对象的数量
配置Hibernate与C3P0连接池
本文详细介绍了在hibernate.cfg.xml中添加C3P0配置的方法,包括设置最大连接数、最小连接数、一次增加的连接数、连接超时时间、连接检测频率及Statement对象缓存数量。
591

被折叠的 条评论
为什么被折叠?



