Package org.apache.commons.dbcp

Examples of org.apache.commons.dbcp.ConnectionFactory


        // pool will use to create Connections.
        // We'll use the DriverManagerConnectionFactory,
        // using the connect string passed in the command line
        // arguments.
        //
        ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectURI,null);

        //
        // Now we'll create the PoolableConnectionFactory, which wraps
        // the "real" Connections created by the ConnectionFactory with
        // the classes that implement the pooling functionality.
View Full Code Here


        // pool will use to create Connections.
        // We'll use the DriverManagerConnectionFactory,
        // using the connect string passed in the command line
        // arguments.
        //
        ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectURI,null);

        //
        // Now we'll create the PoolableConnectionFactory, which wraps
        // the "real" Connections created by the ConnectionFactory with
        // the classes that implement the pooling functionality.
View Full Code Here

        // create a driver connection factory
        Properties properties = new Properties();
        properties.setProperty("user", "username");
        properties.setProperty("password", "password");
        ConnectionFactory connectionFactory = new DriverConnectionFactory(new TesterDriver(), "jdbc:apache:commons:testdriver", properties);

        // wrap it with a LocalXAConnectionFactory
        XAConnectionFactory xaConnectionFactory = new LocalXAConnectionFactory(transactionManager, connectionFactory);

        // create the pool
View Full Code Here

      Class.forName(info.driverName);
    }

    GenericObjectPool connectionPool = new GenericObjectPool(null);
    connectionPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW);
    ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(info.dbURL,
        info.userName, info.password);
    @SuppressWarnings("unused")
    PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(
        connectionFactory, connectionPool, null, null, false, true);
    CustomPoolingDataSource dataSource = new CustomPoolingDataSource(connectionPool);
View Full Code Here

  public DataSource getObject() {
    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

  public ConnectionPoolDataSource(final DataSource underlyingDataSource) {
    if (underlyingDataSource == null) {
      throw new IllegalArgumentException("underlyingDataSource is null");
    }
    ConnectionFactory connectionFactory = new ConnectionFactory() {
      @Override
      public Connection createConnection() throws SQLException {
        Connection connection = underlyingDataSource.getConnection();
        connection.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
        connection.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT);
View Full Code Here

            Properties cfProps = new Properties();
            cfProps.put("user", jdbcUsername);
            cfProps.put("password", jdbcPassword);

            // create the connection factory
            ConnectionFactory cf = new DriverConnectionFactory(jdbcDriver, jdbcUri, cfProps);

            // wrap it with a LocalXAConnectionFactory
            XAConnectionFactory xacf = new LocalXAConnectionFactory(txMgr, cf);

            // configure the pool settings
View Full Code Here

                throw e;
            }
           
            ObjectPool connectionPool = new GenericObjectPool(null, maxActive, whenExhausted, maxWait);
           
            ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectURI, user, password);
           
            dsConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, true);
           
            dataSource = new PoolingDataSource(connectionPool);           
           
View Full Code Here

        TransactionIsolation.getByName(txIsolation);

    LOGGER.debug("Transaction isolation will be set to: " + txIsolationLevel);

    // Setup Datasource
    ConnectionFactory connFactory =
        new DriverManagerConnectionFactory(connectUrl, jdbcProps);

    connectionPool = new GenericObjectPool();

    String maxActiveConnections = getConfigurationString(context,
View Full Code Here

                throw e;
            }
           
            ObjectPool connectionPool = new GenericObjectPool(null, maxActive, whenExhausted, maxWait);
           
            ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectURI, user, password);
           
            dsConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, true);
           
            dataSource = new PoolingDataSource(connectionPool);           
           
View Full Code Here

TOP

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

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.