use of com.mchange.v2.c3p0.ComboPooledDataSource in project druid by alibaba.
the class Case4 method test_c3p0.
public void test_c3p0() throws Exception {
ComboPooledDataSource dataSource = new ComboPooledDataSource();
// dataSource.(10);
// dataSource.setMaxActive(50);
dataSource.setMinPoolSize(minPoolSize);
dataSource.setMaxPoolSize(maxPoolSize);
dataSource.setDriverClass(driverClass);
dataSource.setJdbcUrl(jdbcUrl);
dataSource.setMaxStatements(maxOpenPreparedStatements);
dataSource.setUser(user);
dataSource.setPassword(password);
for (int i = 0; i < loopCount; ++i) {
p0(dataSource, "c3p0", threadCount);
}
System.out.println();
}
use of com.mchange.v2.c3p0.ComboPooledDataSource in project druid by alibaba.
the class TestPSCache method f_test_c3p0.
public void f_test_c3p0() throws Exception {
ComboPooledDataSource ds = new ComboPooledDataSource();
ds.setJdbcUrl("jdbc:mock:test");
ds.setMaxPoolSize(10);
ds.setMinPoolSize(0);
ds.setMaxStatements(10);
for (int i = 0; i < 10; ++i) {
f(ds, 5);
System.out.println("--------------------------------------------");
}
}
use of com.mchange.v2.c3p0.ComboPooledDataSource in project opennms by OpenNMS.
the class ConnectionTrackerTest method testC3poDatabaseConnection.
@Test
@Ignore
public void testC3poDatabaseConnection() throws Exception {
final ComboPooledDataSource cpds = new ComboPooledDataSource();
cpds.setDriverClass("org.postgresql.Driver");
cpds.setUser("opennms");
cpds.setJdbcUrl("jdbc:postgresql://localhost:5432/template1");
final Connection conn = cpds.getConnection();
assertEquals(1, Connections.getPooledConnectionCount());
Connections.printPooledStatus();
conn.close();
assertEquals(0, Connections.getPooledConnectionCount());
Connections.printPooledStatus();
}
use of com.mchange.v2.c3p0.ComboPooledDataSource in project midpoint by Evolveum.
the class DataSourceFactory method destroy.
public void destroy() {
if (dataSource instanceof ComboPooledDataSource) {
ComboPooledDataSource ds = (ComboPooledDataSource) dataSource;
ds.close();
}
}
use of com.mchange.v2.c3p0.ComboPooledDataSource in project midpoint by Evolveum.
the class DataSourceFactory method createC3P0DataSource.
private DataSource createC3P0DataSource() throws PropertyVetoException {
ComboPooledDataSource ds = new ComboPooledDataSource();
ds.setDriverClass(configuration.getDriverClassName());
ds.setJdbcUrl(configuration.getJdbcUrl());
ds.setUser(configuration.getJdbcUsername());
ds.setPassword(configuration.getJdbcPassword());
ds.setAcquireIncrement(3);
ds.setMinPoolSize(configuration.getMinPoolSize());
ds.setMaxPoolSize(configuration.getMaxPoolSize());
ds.setIdleConnectionTestPeriod(1800);
ds.setConnectionTesterClassName(MidPointConnectionTester.class.getName());
ds.setConnectionCustomizerClassName(MidPointConnectionCustomizer.class.getName());
return ds;
}
Aggregations