c3p0数据库连接池
时间:2021-07-01 10:21:17
帮助过:27人阅读
xml version="1.0" encoding="UTF-8"?>
<c3p0-config>
<!-- This app is massive! -->
<named-config name="c3p0">
<property name="user">root
</property>
<property name="password">root
</property>
<property name="driverClass">com.mysql.jdbc.Driver
</property>
<property name="jdbcUrl">jdbc:mysql://127.0.0.1:3306/hibernate
</property>
<!-- 若数据库连接不足时一次性向数据库申请多少连接 -->
<property name="acquireIncrement">5
</property>
<property name="initialPoolSize">5
</property>
<property name="minPoolSize">5
</property>
<property name="maxPoolSize">10
</property>
</named-config>
</c3p0-config>
4、编写测试
@Test
public void testC3p0() {
DataSource ds = new ComboPooledDataSource("c3p0");
try {
System.out.println(ds.getConnection());
} catch (SQLException e) {
e.printStackTrace();
}
}
c3p0数据库连接池
标签:blog com cti trace direct driver common nbsp rem