private static String url = "jdbc:mysql://localhost:3306/zdbang_net";
private static String user = "root";
private static String passwd = "admin";
private static String driver = "com.mysql.jdbc.Driver";
private ComboPooledDataSource cpds;
private static DbUtil db = new DbUtil();
public static DbUtil getInstance() {
return db;
}
private DbUtil() {
cpds = new ComboPooledDataSource();
try {
cpds.setDriverClass( driver);
cpds.setJdbcUrl( url );
cpds.setUser(user);
cpds.setPassword(passwd);
cpds.setMinPoolSize(5);
cpds.setAcquireIncrement(5);
cpds.setMaxPoolSize(30);
cpds.setMaxIdleTime(60);
} catch (PropertyVetoException e) {
e.printStackTrace();
}
}