数据库连接池工具类utils----C3P0Utils
public class C3P0Utils {
//创建c3p0连接池
private static DataSource dataSource = new ComboPooledDataSource();
//创建连接池
public static DataSource getDataSource() {
return dataSource;
}
//获取连接
public static Connection getConnection() {
try {
Connection conn = dataSource.getConnection();
return conn;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}