Package org.apache.commons.dbcp

Examples of org.apache.commons.dbcp.ConnectionFactory


    Properties connectionProperties = new Properties();
    connectionProperties.put("user", uname);
    connectionProperties.put("password", passwd);

    ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectURI, connectionProperties);

    @SuppressWarnings("unused")
    PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectionPool, statementPoolFactory, "SELECT 1", false, true);

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


    // Create the actual pool of connections
    ObjectPool connectionPool = new GenericObjectPool(null);

    // Create the factory to be used by the pool to create the connections
    ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(url, user, passwd);

    // Create a factory for caching the PreparedStatements
    KeyedObjectPoolFactory kpf = new StackKeyedObjectPoolFactory(null, 20);

    // Wrap the connections with pooled variants
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 = null;

        connectionFactory = new DriverManagerConnectionFactory(
            this.connectionURI, this.userid, this.password );

        // Now we'll create the PoolableConnectionFactory, which wraps
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 = null;
        if ( this.connectionURI.startsWith( MYSQL ) )
        {
            StringBuffer sb = new StringBuffer( this.connectionURI );
            sb.append( MYSQL_USER );
            if ( this.userid != null )
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 = null;

        connectionFactory = new DriverManagerConnectionFactory(
            this.connectionURI, this.userid, this.password );

        // Now we'll create the PoolableConnectionFactory, which wraps
View Full Code Here

        GenericObjectPool connectionPool =
                new GenericObjectPool(null, maxActive, GenericObjectPool.WHEN_EXHAUSTED_BLOCK, 3000, maxIdle, false,
                        false, 60000, 5, 30000, true);

        ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectURI, username, password);

        PoolableConnectionFactory poolableConnectionFactory =
                new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, true);

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

    GenericObjectPool gPool = new GenericObjectPool(null);
    gPool.setMaxActive(maxLimit);

    connectionPool = gPool;

    ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(jdbcUrl, userId, userPwd);
    PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectionPool, null, "select 1", false, true);
    poolableConnectionFactory.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);

    dataSource = new PoolingDataSource(connectionPool);
  }
View Full Code Here

    }
    connectPool = new GenericObjectPool(null);
    connectPool.setMaxActive(maxLimit);
    connectPool.setMaxIdle(maxLimit / 2);

    ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(getJdbcURL(), getUserId(), getUserPwd());
    PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectPool, null, null, true, true);
    poolableConnectionFactory.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);

    PoolingDriver driver = new PoolingDriver();
    driver.registerPool(DriverName, connectPool);
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(this.ds, username, password);
            XAConnectionFactory xaConnectionFactory = new LocalXAConnectionFactory(getTransactionManager(), connectionFactory);
            setTransactionRegistry(xaConnectionFactory.getTransactionRegistry());
            return xaConnectionFactory;
        }
    }
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.