Search in sources :

Example 1 with ComboPooledDataSource

use of com.mchange.v2.c3p0.ComboPooledDataSource in project druid by alibaba.

the class TestRollBack method init.

//  jdbcUrl = "jdbc:oracle:thin:@a.b.c.d:1521:ocnauto";
//  user = "alibaba";
//  password = "ccbuauto";
@BeforeClass
public static void init() throws PropertyVetoException, SQLException {
    c3p0 = new ComboPooledDataSource();
    //c3p0.setDriverClass("oracle.jdbc.driver.OracleDriver");
    c3p0.setDriverClass(driver);
    c3p0.setJdbcUrl(url);
    c3p0.setUser(user);
    c3p0.setPassword(password);
    druid = new DruidDataSource();
    druid.setUrl(url);
    druid.setUsername(user);
    druid.setPassword(password);
    druid.setFilters("stat,trace,encoding");
    druid.setDefaultAutoCommit(false);
    dao_c3p0 = new NutDao(c3p0);
    dao_druid = new NutDao(druid);
    if (!dao_c3p0.exists("msg")) {
        // 字段长度5
        dao_c3p0.execute(Sqls.create("create table msg(message varchar(5))"));
    }
}
Also used : ComboPooledDataSource(com.mchange.v2.c3p0.ComboPooledDataSource) NutDao(org.nutz.dao.impl.NutDao) DruidDataSource(com.alibaba.druid.pool.DruidDataSource) BeforeClass(org.junit.BeforeClass)

Example 2 with ComboPooledDataSource

use of com.mchange.v2.c3p0.ComboPooledDataSource in project druid by alibaba.

the class Case0 method f_test_c3p0.

public void f_test_c3p0() throws Exception {
    ComboPooledDataSource dataSource = new ComboPooledDataSource();
    // dataSource.(10);
    // dataSource.setMaxActive(50);
    dataSource.setMinPoolSize(minIdle);
    dataSource.setMaxPoolSize(maxIdle);
    dataSource.setDriverClass(driverClass);
    dataSource.setJdbcUrl(jdbcUrl);
    // dataSource.setPoolPreparedStatements(true);
    // dataSource.setMaxOpenPreparedStatements(100);
    dataSource.setUser(user);
    dataSource.setPassword(password);
    for (int i = 0; i < LOOP_COUNT; ++i) {
        p0(dataSource, "c3p0");
    }
    System.out.println();
}
Also used : ComboPooledDataSource(com.mchange.v2.c3p0.ComboPooledDataSource)

Example 3 with ComboPooledDataSource

use of com.mchange.v2.c3p0.ComboPooledDataSource in project druid by alibaba.

the class TestLRU 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);
    for (int i = 0; i < 10; ++i) {
        f(ds, 5);
        System.out.println("--------------------------------------------");
    }
}
Also used : ComboPooledDataSource(com.mchange.v2.c3p0.ComboPooledDataSource)

Example 4 with ComboPooledDataSource

use of com.mchange.v2.c3p0.ComboPooledDataSource in project jforum2 by rafaelsteil.

the class C3P0PooledConnection method init.

/**
	 * 
	 * @see net.jforum.DBConnection#init()
	 */
public void init() throws Exception {
    this.ds = new ComboPooledDataSource();
    this.ds.setDriverClass(SystemGlobals.getValue(ConfigKeys.DATABASE_CONNECTION_DRIVER));
    this.ds.setJdbcUrl(SystemGlobals.getValue(ConfigKeys.DATABASE_CONNECTION_STRING));
    this.ds.setMinPoolSize(SystemGlobals.getIntValue(ConfigKeys.DATABASE_POOL_MIN));
    this.ds.setMaxPoolSize(SystemGlobals.getIntValue(ConfigKeys.DATABASE_POOL_MAX));
    this.ds.setIdleConnectionTestPeriod(SystemGlobals.getIntValue(ConfigKeys.DATABASE_PING_DELAY));
    this.extraParams();
}
Also used : ComboPooledDataSource(com.mchange.v2.c3p0.ComboPooledDataSource)

Example 5 with ComboPooledDataSource

use of com.mchange.v2.c3p0.ComboPooledDataSource in project databus by linkedin.

the class MysqlMaxSCNHandler method create.

public static MysqlMaxSCNHandler create(StaticConfig config) throws DatabusException {
    ComboPooledDataSource cpds = createConnectionPool(config);
    MysqlMaxSCNHandler handler = new MysqlMaxSCNHandler(config, cpds);
    handler.loadInitialValue(cpds);
    return handler;
}
Also used : ComboPooledDataSource(com.mchange.v2.c3p0.ComboPooledDataSource)

Aggregations

ComboPooledDataSource (com.mchange.v2.c3p0.ComboPooledDataSource)23 SQLException (java.sql.SQLException)6 PropertyVetoException (java.beans.PropertyVetoException)4 Properties (java.util.Properties)3 ArrayList (java.util.ArrayList)2 DataSource (javax.sql.DataSource)2 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)1 MidPointConnectionCustomizer (com.evolveum.midpoint.repo.sql.util.MidPointConnectionCustomizer)1 MidPointConnectionTester (com.evolveum.midpoint.repo.sql.util.MidPointConnectionTester)1 ApplicationException (com.github.hakko.musiccabinet.exception.ApplicationException)1 BoneCPConfig (com.jolbox.bonecp.BoneCPConfig)1 BoneCPDataSource (com.jolbox.bonecp.BoneCPDataSource)1 DatabusException (com.linkedin.databus2.core.DatabusException)1 HikariConfig (com.zaxxer.hikari.HikariConfig)1 HikariDataSource (com.zaxxer.hikari.HikariDataSource)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 CallableStatement (java.sql.CallableStatement)1 Connection (java.sql.Connection)1