Package org.apache.commons.dbcp

Examples of org.apache.commons.dbcp.ConnectionFactory


        }
    }

    private ObjectPool createConnectionPool() {

        ConnectionFactory factory = createConnectionFactory();
        GenericObjectPool.Config poolConfig = createConnectionPoolConfig();
        KeyedObjectPoolFactory statementPool = createPreparedStatementPool();

        String validationQuery = config.getString(VALIDATION_QUERY);
        boolean defaultReadOnly = config.getBoolean(READ_ONLY, false);
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

            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

            return xaConnectionFactory;

        }

        // If xa data source is not specified a DriverConnectionFactory is created and wrapped with a LocalXAConnectionFactory
        final ConnectionFactory connectionFactory = new DataSourceConnectionFactory(DataSource.class.cast(ds), username, password);
        final XAConnectionFactory xaConnectionFactory = new LocalXAConnectionFactory(getTransactionManager(), connectionFactory);
        setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
        return xaConnectionFactory;
    }
View Full Code Here

            throw new SQLException("Transaction manager must be set before a connection can be created");
        }

        // If xa data source is not specified a DriverConnectionFactory is created and wrapped with a LocalXAConnectionFactory
        if (xaDataSource == null) {
            ConnectionFactory connectionFactory = super.createConnectionFactory();
            XAConnectionFactory xaConnectionFactory = new LocalXAConnectionFactory(getTransactionManager(), connectionFactory);
            transactionRegistry = 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 ObjectPool createConnectionPool() {

        ConnectionFactory factory = createConnectionFactory();
        GenericObjectPool.Config poolConfig = createConnectionPoolConfig();
        KeyedObjectPoolFactory statementPool = createPreparedStatementPool();

        String validationQuery = config.getString(VALIDATION_QUERY);
        boolean defaultReadOnly = config.getBoolean(READ_ONLY, false);
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 = context.getString(
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

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.