use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class DruidCase0 method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setMaxActive(8);
dataSource.setMinIdle(1);
dataSource.setMinEvictableIdleTimeMillis(1000 * 60 * 5);
}
use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class Case1 method test_druid.
public void test_druid() throws Exception {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setInitialSize(initialSize);
dataSource.setMaxActive(maxActive);
dataSource.setMinIdle(minPoolSize);
dataSource.setMaxIdle(maxPoolSize);
dataSource.setPoolPreparedStatements(true);
dataSource.setDriverClassName(driverClass);
dataSource.setUrl(jdbcUrl);
dataSource.setPoolPreparedStatements(true);
dataSource.setUsername(user);
dataSource.setPassword(password);
dataSource.setValidationQuery(validationQuery);
dataSource.setTestOnBorrow(false);
for (int i = 0; i < loopCount; ++i) {
p0(dataSource, "druid", threadCount);
}
System.out.println();
}
use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class CaseKylin_mysql method druid.
public void druid() throws Exception {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setInitialSize(initialSize);
dataSource.setMaxActive(maxActive);
dataSource.setMaxIdle(maxIdle);
dataSource.setMinIdle(minIdle);
dataSource.setMaxWait(maxWait);
dataSource.setPoolPreparedStatements(true);
dataSource.setDriverClassName(driverClass);
dataSource.setUrl(jdbcUrl);
dataSource.setPoolPreparedStatements(true);
dataSource.setUsername(user);
dataSource.setPassword(password);
dataSource.setValidationQuery(validationQuery);
dataSource.setTestOnBorrow(testOnBorrow);
dataSource.setTestOnBorrow(testWhileIdle);
dataSource.setTestOnBorrow(testOnReturn);
dataSource.setRemoveAbandoned(removeAbandoned);
dataSource.setRemoveAbandonedTimeout(removeAbandonedTimeout);
dataSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
dataSource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
dataSource.setNumTestsPerEvictionRun(numTestsPerEvictionRun);
for (int i = 0; i < TEST_COUNT; ++i) {
p0(dataSource, "druid", threadCount);
}
System.out.println();
}
use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class Oracle_Case0 method test_0.
public void test_0() throws Exception {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setInitialSize(initialSize);
dataSource.setMaxActive(maxActive);
dataSource.setMinIdle(minPoolSize);
dataSource.setMaxIdle(maxPoolSize);
dataSource.setPoolPreparedStatements(true);
dataSource.setDriverClassName(driverClass);
dataSource.setUrl(jdbcUrl);
dataSource.setPoolPreparedStatements(true);
dataSource.setUsername(user);
dataSource.setPassword(password);
dataSource.setValidationQuery(validationQuery);
dataSource.setTestOnBorrow(true);
for (int i = 0; i < LOOP_COUNT; ++i) {
p0(dataSource, "druid");
}
System.out.println();
}
use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class Oracle_Case4 method test_druid.
public void test_druid() throws Exception {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setMaxActive(maxActive);
dataSource.setMaxIdle(maxIdle);
dataSource.setMaxWait(maxWait);
dataSource.setPoolPreparedStatements(preparedStatementCache);
dataSource.setMaxOpenPreparedStatements(preparedStatementCacheSize);
dataSource.setDriverClassName(driverClass);
dataSource.setUrl(jdbcUrl);
dataSource.setUsername(user);
dataSource.setPassword(password);
dataSource.setValidationQuery(validationQuery);
dataSource.setTestOnBorrow(testOnBorrow);
dataSource.setConnectionProperties(properties);
dataSource.setUseOracleImplicitCache(true);
dataSource.init();
for (int i = 0; i < loopCount; ++i) {
p0(dataSource, "druid", threadCount);
}
System.out.println();
}
Aggregations