import com.mchange.v2.c3p0.ComboPooledDataSource;
private ComboPooledDataSource dataSource;
private void DBPool(){
try{
ResourceBundle config = ResourceBundle.getBundle("jdbc");
dataSource=new ComboPooledDataSource();
dataSource.setUser(config.getString("jdbc.user"));
dataSource.setPassword(config.getString("jdbc.password"));
dataSource.setJdbcUrl(config.getString("jdbc.url"));
dataSource.setDriverClass(config.getString("jdbc.driver"));
dataSource.setInitialPoolSize(2);
dataSource.setMinPoolSize(1);
dataSource.setMaxPoolSize(5);
dataSource.setMaxStatements(0);
dataSource.setMaxIdleTime(60);
}
catch
(Exception e)
{
log.error(e);
}
}
public final Connection getConnection1() {
try
{
return dataSource.getConnection();
}
catch(SQLException e)
{
log.error(e);
return null;
}
}