use of org.apache.commons.dbcp.BasicDataSource in project sharding-jdbc by dangdangdotcom.
the class RdbTransactionLogStorageOperationsTest method assertRdbTransactionLogStorageOperations.
@Test
public void assertRdbTransactionLogStorageOperations() throws SQLException {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(org.h2.Driver.class.getName());
dataSource.setUrl("jdbc:h2:mem:db_transaction_storage");
dataSource.setUsername("sa");
dataSource.setPassword("");
createTable(dataSource);
TransactionLogStorage storage = new RdbTransactionLogStorage(dataSource);
assertTransactionLogStorageOperations(storage);
}
use of org.apache.commons.dbcp.BasicDataSource in project sharding-jdbc by dangdangdotcom.
the class RdbTransactionLogStorageTest method setup.
@Before
public void setup() throws SQLException {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(org.h2.Driver.class.getName());
dataSource.setUrl("jdbc:h2:mem:db_trans");
dataSource.setUsername("sa");
createTable(dataSource);
storage = new RdbTransactionLogStorage(dataSource);
}
use of org.apache.commons.dbcp.BasicDataSource in project sharding-jdbc by dangdangdotcom.
the class Main method createTransactionLogDataSource.
private static DataSource createTransactionLogDataSource() {
BasicDataSource result = new BasicDataSource();
result.setDriverClassName(com.mysql.jdbc.Driver.class.getName());
result.setUrl("jdbc:mysql://localhost:3306/trans_log");
result.setUsername("root");
result.setPassword("");
return result;
}
use of org.apache.commons.dbcp.BasicDataSource in project sharding-jdbc by dangdangdotcom.
the class Main method createDataSource.
private static DataSource createDataSource(final String dataSourceName) {
BasicDataSource result = new BasicDataSource();
result.setDriverClassName(com.mysql.jdbc.Driver.class.getName());
result.setUrl(String.format("jdbc:mysql://localhost:3306/%s", dataSourceName));
result.setUsername("root");
result.setPassword("");
return result;
}
use of org.apache.commons.dbcp.BasicDataSource in project druid by alibaba.
the class Case4 method test_dbcp.
public void test_dbcp() throws Exception {
final BasicDataSource dataSource = new BasicDataSource();
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.setMaxOpenPreparedStatements(maxOpenPreparedStatements);
dataSource.setUsername(user);
dataSource.setPassword(password);
dataSource.setValidationQuery("SELECT 1");
dataSource.setTestOnBorrow(false);
for (int i = 0; i < loopCount; ++i) {
p0(dataSource, "dbcp", threadCount);
}
System.out.println();
}
Aggregations