Search in sources :

Example 36 with ComboPooledDataSource

use of com.mchange.v2.c3p0.jacksonTest.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 37 with ComboPooledDataSource

use of com.mchange.v2.c3p0.jacksonTest.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 38 with ComboPooledDataSource

use of com.mchange.v2.c3p0.jacksonTest.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 39 with ComboPooledDataSource

use of com.mchange.v2.c3p0.jacksonTest.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();
}
Also used : ComboPooledDataSource(com.mchange.v2.c3p0.ComboPooledDataSource)

Example 40 with ComboPooledDataSource

use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project midpoint by Evolveum.

the class DataSourceFactory method destroy.

public void destroy() {
    if (dataSource instanceof ComboPooledDataSource) {
        ComboPooledDataSource ds = (ComboPooledDataSource) dataSource;
        ds.close();
    }
}
Also used : ComboPooledDataSource(com.mchange.v2.c3p0.ComboPooledDataSource)

Aggregations

ComboPooledDataSource (com.mchange.v2.c3p0.ComboPooledDataSource)69 PropertyVetoException (java.beans.PropertyVetoException)16 SQLException (java.sql.SQLException)13 Connection (java.sql.Connection)7 Test (org.junit.Test)7 Bean (org.springframework.context.annotation.Bean)7 Properties (java.util.Properties)5 DataSource (javax.sql.DataSource)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 ComboPooledDataSource (com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource)4 ResultSet (java.sql.ResultSet)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Path (javax.ws.rs.Path)3 Produces (javax.ws.rs.Produces)3 DbRuntimeException (cn.hutool.db.DbRuntimeException)2 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)2 Duration (de.invesdwin.util.time.duration.Duration)2 PreparedStatement (java.sql.PreparedStatement)2 EntityManagerFactory (javax.persistence.EntityManagerFactory)2