Java Code Examples for com.jolbox.bonecp.BoneCPDataSource#setDriverClass()
The following examples show how to use
com.jolbox.bonecp.BoneCPDataSource#setDriverClass() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BoneCPDataSourceFactoryBean.java From cloud-config with MIT License | 6 votes |
private BoneCPDataSource createNewDataSource() { BoneCPDataSource target = new BoneCPDataSource(); target.setDriverClass(config.getDriverClassName()); target.setJdbcUrl(config.getJdbcUrl()); target.setUsername(config.getUserName()); target.setPassword(config.getPassword()); target.setIdleConnectionTestPeriodInMinutes(config.getIdleConnectionTestPeriodInMinutes()); target.setIdleMaxAgeInMinutes(config.getIdleMaxAgeInMinutes()); target.setMaxConnectionsPerPartition(config.getMaxConnectionsPerPartition()); target.setMinConnectionsPerPartition(config.getMinConnectionsPerPartition()); target.setPartitionCount(config.getPartitionCount()); target.setAcquireIncrement(config.getAcquireIncrement()); target.setStatementsCacheSize(config.getStatementsCacheSize()); target.setDisableJMX(true); return target; }
Example 2
Source File: CompareWithPopularPool.java From clearpool with GNU General Public License v3.0 | 6 votes |
@Test public void testBonecp() throws Exception { BoneCPDataSource dataSource = new BoneCPDataSource(); dataSource.setMinConnectionsPerPartition(this.corePoolSize); dataSource.setMaxConnectionsPerPartition(this.maxPoolSize); dataSource.setDriverClass(this.driverClassName); dataSource.setJdbcUrl(this.url); dataSource.setStatementsCacheSize(100); dataSource.setServiceOrder("LIFO"); dataSource.setUsername(this.username); dataSource.setPassword(this.password); dataSource.setPartitionCount(1); dataSource.setAcquireIncrement(5); for (int i = 0; i < this.loop; ++i) { ThreadProcessUtils.process(dataSource, "boneCP", this.count, threadCount, physicalCon); } System.out.println(); }
Example 3
Source File: DefaultDataSourceProvider.java From hadoop-ozone with Apache License 2.0 | 5 votes |
/** * Create a pooled datasource for the application. * * Default sqlite database does not work with a connection pool, actually * most embedded databases do not, hence returning native implementation for * default db. */ @Override public DataSource get() { String jdbcUrl = configuration.getJdbcUrl(); if (StringUtils.contains(jdbcUrl, "derby")) { return new DerbyDataSourceProvider(configuration).get(); } else if (StringUtils.contains(jdbcUrl, "sqlite")) { return new SqliteDataSourceProvider(configuration).get(); } BoneCPDataSource cpDataSource = new BoneCPDataSource(); cpDataSource.setDriverClass(configuration.getDriverClass()); cpDataSource.setJdbcUrl(configuration.getJdbcUrl()); cpDataSource.setUsername(configuration.getUserName()); cpDataSource.setPassword(configuration.getPassword()); cpDataSource.setDefaultAutoCommit(configuration.setAutoCommit()); cpDataSource.setConnectionTimeoutInMs(configuration.getConnectionTimeout()); cpDataSource.setMaxConnectionsPerPartition( configuration.getMaxActiveConnections()); cpDataSource.setMaxConnectionAgeInSeconds( configuration.getMaxConnectionAge()); cpDataSource.setIdleMaxAgeInSeconds( configuration.getMaxIdleConnectionAge()); cpDataSource.setIdleConnectionTestPeriodInSeconds( configuration.getIdleConnectionTestPeriod()); cpDataSource.setConnectionTestStatement( configuration.getConnectionTestStatement()); return cpDataSource; }
Example 4
Source File: SequenceDaoTest.java From cloud-config with MIT License | 5 votes |
@Before public void setUp() throws Exception { dataSource = new BoneCPDataSource(); dataSource.setDriverClass("org.h2.Driver"); dataSource.setJdbcUrl(JDBC_URL); jdbcSequenceDao = new JdbcSequenceDao(); jdbcSequenceDao.setJdbcTemplate(new JdbcTemplate(dataSource)); jdbcSequenceDao.setStep(step); jdbcSequenceDao.setDefaultMaxLimit(maxLimit); }