Package org.apache.commons.dbcp

Examples of org.apache.commons.dbcp.PoolingDataSource


        //
        // Finally, we create the PoolingDriver itself,
        // passing in the object pool we created.
        //
        PoolingDataSource dataSource = new PoolingDataSource(connectionPool);

        return dataSource;
    }
View Full Code Here


        } catch(Exception e) {
            throw new SQLException(e.toString());
        }

        // Create and return the pooling data source to manage the connections
        dataSource = new PoolingDataSource(connectionPool);
        dataSource.setLogWriter(logWriter);
        return (dataSource);

    }
View Full Code Here

    if (underlyingDataSource == null) {
      throw new IllegalArgumentException("underlyingDataSource is null");
    }
    PoolableObjectFactory poolFactory = new DataSourceConnectionFactory(underlyingDataSource);
    ObjectPool connectionPool = new StackObjectPool(poolFactory);
    this.delegate = new PoolingDataSource(connectionPool);
  }
View Full Code Here

    }

    DataSource createDataSource() {
        boolean connectionNoWrap = config.getBoolean(CONNECTION_NOWRAP, false);
        ObjectPool connectionPool = createConnectionPool();
        PoolingDataSource dataSource = new PoolingDataSource(connectionPool);
        dataSource.setAccessToUnderlyingConnectionAllowed(connectionNoWrap);

        return dataSource;
    }
View Full Code Here

    // Creating the factory instance automatically wires the connection pool
    new PoolableConnectionFactory(connFactory, connectionPool, statementPool,
        databaseType.getValidationQuery(), false, false,
        txIsolationLevel.getCode());

    dataSource = new PoolingDataSource(connectionPool);

    txFactory = new JdbcTransactionFactory(dataSource);
  }
View Full Code Here

    objectPool.setTestOnReturn(false);
    objectPool.setTestWhileIdle(true);
    objectPool.setTimeBetweenEvictionRunsMillis(60 * 1000L);
    // Constructor actually sets itself as factory on pool
    new PoolableConnectionFactory(connectionFactory, objectPool, null, "SELECT 1", false, false);
    delegate = new PoolingDataSource(objectPool);
  }
View Full Code Here

        //
        // Finally, we create the PoolingDriver itself,
        // passing in the object pool we created.
        //
        PoolingDataSource dataSource = new PoolingDataSource(connectionPool);

        return dataSource;
    }
View Full Code Here

        Properties props = new Properties();
        props.setProperty("user", "username");
        props.setProperty("password", "password");
        NonDelegatingPoolableConnectionFactory factory = new NonDelegatingPoolableConnectionFactory(new DriverConnectionFactory(new TesterDriver(), "jdbc:apache:commons:testdriver", props), pool);
        pool.setFactory(factory);
        ds = new PoolingDataSource(pool);
        checkManagedConnectionEqualsReflexive();
    }
View Full Code Here

    GenericObjectPool.Config config=new GenericObjectPool.Config();
    config.maxActive=16;
    ObjectPool connectionPool = new GenericObjectPool(null,config);
    ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(url, username, password);
    new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, true);
    return new PoolingDataSource(connectionPool);
  }
View Full Code Here

    objectPool.setTestWhileIdle(true);
    objectPool.setTimeBetweenEvictionRunsMillis(60 * 1000L);
    PoolableObjectFactory factory =
            new PoolableConnectionFactory(connectionFactory, objectPool, null, "SELECT 1", false, false);
    objectPool.setFactory(factory);
    delegate = new PoolingDataSource(objectPool);
  }
View Full Code Here

TOP

Related Classes of org.apache.commons.dbcp.PoolingDataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.