1.导入相关jar
1.编写c3p0-config.xml
// 创建c3p0连接池核心工具类
// 自动加载src下c3p0的配置文件【c3p0-config.xml】
ComboPooledDataSource dataSource = new ComboPooledDataSource();// 使用默认的配置
PreparedStatement pstmt = null;
// 获取连接
Connection con = dataSource.getConnection();
for (int i=1; i<100;i++){
String sql = "insert into ee set name='11'";
// 执行更新
pstmt = con.prepareStatement(sql);
pstmt.executeUpdate();
}
pstmt.close();
// 关闭
con.close();