一、配置c3p0
1、导入 hibernate-c3po连接池包,Maven地址是:http://mvnrepository.com/artifact/org.hibernate/hibernate-c3p0/5.2.16.Final
org.hibernate hibernate-c3p0 5.2.16.Final
2、修改hibernate.cfg.xml
com.mysql.cj.jdbc.Driver jdbc:mysql://127.0.0.1:3306/testdb?characterEncoding=utf8&useUnicode=true&useSSL=false&serverTimezone=Asia/Shanghai root 123456 org.hibernate.dialect.MySQLDialect true true update org.hibernate.c3p0.internal.C3P0ConnectionProvider 20 5 120 3000 2
二、其它配置
3 30 1000 false Test false 100 null false 60 3 60 15 100 3 root password select id from test where id=1 300 false true root 在Hibernate(spring管理)中的配置:编辑本段相关信息连接池配置(以Hibernate为例)############################## C3P0 Connection Pool###############################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在hibernate.cfg.xml文件里面加入如下的配置: oracle.jdbc.driver.OracleDriver jdbc:oracle:thin:@localhost:1521:Test Kay root 20 5 120 100 120 2 true