Example usage for org.apache.commons.dbcp2 PoolingDriver PoolingDriver

List of usage examples for org.apache.commons.dbcp2 PoolingDriver PoolingDriver

Introduction

In this page you can find the example usage for org.apache.commons.dbcp2 PoolingDriver PoolingDriver.

Prototype

public PoolingDriver() 

Source Link

Usage

From source file:org.apache.zeppelin.jdbc.JDBCInterpreter.java

private void createConnectionPool(String url, String user, String propertyKey, Properties properties)
        throws SQLException, ClassNotFoundException {
    ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(url, properties);

    PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,
            null);//from  w  ww  .j  av a  2 s . c o m
    ObjectPool connectionPool = new GenericObjectPool(poolableConnectionFactory);

    poolableConnectionFactory.setPool(connectionPool);
    Class.forName(properties.getProperty(DRIVER_KEY));
    PoolingDriver driver = new PoolingDriver();
    driver.registerPool(propertyKey + user, connectionPool);
    getJDBCConfiguration(user).saveDBDriverPool(propertyKey, driver);
}