Package org.apache.commons.dbcp

Examples of org.apache.commons.dbcp.PoolingDataSource


        final GenericObjectPool connectionPool = new GenericObjectPool(null, 5);
        final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
           "jdbc:mysql://localhost:3306/" + database, "cloud", "cloud");
        final PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(
           connectionFactory, connectionPool, null, null, false, true);
        return new PoolingDataSource(
           /* connectionPool */poolableConnectionFactory.getPool());
    }
View Full Code Here


    // creating the factor automatically wires the connection pool
    new PoolableConnectionFactory(connFactory, connectionPool, statementPool,
        handler.validationQuery(), false, false,
        repoContext.getTransactionIsolation().getCode());

    dataSource = new PoolingDataSource(connectionPool);
    txFactory = new JdbcRepositoryTransactionFactory(dataSource);

    repoContext.initialize(dataSource, txFactory);

    handler.initialize(repoContext);
View Full Code Here

        ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
                url, user, pass);
        PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(
                connectionFactory, connectionPool, null, null, false, true);

        ds = new PoolingDataSource(connectionPool);

        return ds;
    }
View Full Code Here

    PoolableConnectionFactory factory = new PoolableConnectionFactory(connectionFactory,
        this.pool, null, hasValQuery ? validationQuery : null, false, true,
        defaultTransactionIsolation, abandonedConfig);

    this.pool.setFactory(factory);
    PoolingDataSource dataSource;
    if (dataService.isEnableXA()) {
      /* for XA-transactions */
      dataSource = new ManagedDataSource(this.pool,
          ((XAConnectionFactory) connectionFactory).getTransactionRegistry());
    } else {
      dataSource = new PoolingDataSource(this.pool);
    }
    dataSource.setAccessToUnderlyingConnectionAllowed(true);
    return dataSource;
  }
View Full Code Here

    // creating the factor automatically wires the connection pool
    new PoolableConnectionFactory(connFactory, connectionPool, statementPool,
        handler.validationQuery(), false, false,
        repoContext.getTransactionIsolation().getCode());

    dataSource = new PoolingDataSource(connectionPool);
    txFactory = new JdbcRepositoryTransactionFactory(dataSource);

    repoContext.initialize(dataSource, txFactory);

    handler.initialize(repoContext);
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

    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

    }

    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

        transactionRegistry = xaConnectionFactory.getTransactionRegistry();
        return xaConnectionFactory;
    }

    protected void createDataSourceInstance() throws SQLException {
        PoolingDataSource pds = new ManagedDataSource(connectionPool, transactionRegistry);
        pds.setAccessToUnderlyingConnectionAllowed(isAccessToUnderlyingConnectionAllowed());
        pds.setLogWriter(logWriter);
        dataSource = pds;
    }
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.