Package org.apache.commons.dbcp

Examples of org.apache.commons.dbcp.ConnectionFactory


            Class.forName(driver);
        } catch (ClassNotFoundException ignore) {
        }

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

        ds = new PoolingDataSource(connectionPool);
View Full Code Here


   * @param externalDS The data source to be used
   * @return Pooled data source
   * @throws Exception
   */
  private DataSource setupDataSource(Config config, DataSource externalDS) throws Exception {
    ConnectionFactory connectionFactory;
    DataService dataService = config.getDataService();
    String jdbcURL = config.getProperty(RDBMS.PROTOCOL);
    String userName = config.getProperty(RDBMS.USER);
    String password = DBUtils.resolvePasswordValue(config.getDataService(),
        config.getProperty(RDBMS.PASSWORD));
View Full Code Here

        // connections
        ObjectPool result = new GenericObjectPool(null);

        // Create a ConnectionFactory that the pool will use to create
        // Connections
        ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
                uri, properties);

        // Create the PoolableConnectionFactory, which wraps the "real"
        // Connections created by the ConnectionFactory with
        // the classes that implement the pooling functionality.
View Full Code Here

          jdbcDriverClassName, ex);
    }

    Properties jdbcProps = repoContext.getConnectionProperties();

    ConnectionFactory connFactory =
        new DriverManagerConnectionFactory(connectUrl, jdbcProps);

    connectionPool = new GenericObjectPool();
    connectionPool.setMaxActive(repoContext.getMaximumConnections());
View Full Code Here

 
  private final DataSource delegate;
 
  public ConnectionPoolDataSource(DataSource underlyingDataSource) {
    Preconditions.checkNotNull(underlyingDataSource);
    ConnectionFactory connectionFactory = new ConfiguringConnectionFactory(underlyingDataSource);
    GenericObjectPool objectPool = new GenericObjectPool();
    objectPool.setTestOnBorrow(false);
    objectPool.setTestOnReturn(false);
    objectPool.setTestWhileIdle(true);
    objectPool.setTimeBetweenEvictionRunsMillis(60 * 1000L);
 
View Full Code Here

        // using the connect string passed in the command line
        // arguments.
        // Properties props = new Properties();
        // props.setProperty( "user", userName );
        // props.setProperty( "password", password );
        ConnectionFactory connectionFactory = new DriverManagerConnectionFactory( connectURI, userName, password );

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

                return xaConnectionFactory;

            } else {

                // If xa data source is not specified a DriverConnectionFactory is created and wrapped with a LocalXAConnectionFactory
                ConnectionFactory connectionFactory = new DataSourceConnectionFactory(dataSource, username, password);
                XAConnectionFactory xaConnectionFactory = new LocalXAConnectionFactory(getTransactionManager(), connectionFactory);
                setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
                return xaConnectionFactory;
            }
        }
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

        // 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

 
  private final DataSource delegate;
 
  public ConnectionPoolDataSource(DataSource underlyingDataSource) {
    Preconditions.checkArgument(underlyingDataSource != null, "underlyingDataSource is null");
    ConnectionFactory connectionFactory = new ConfiguringConnectionFactory(underlyingDataSource);
    GenericObjectPool objectPool = new GenericObjectPool();
    objectPool.setTestOnBorrow(false);
    objectPool.setTestOnReturn(false);
    objectPool.setTestWhileIdle(true);
    objectPool.setTimeBetweenEvictionRunsMillis(60 * 1000L);
 
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.