Example usage for org.apache.commons.dbcp BasicDataSource setInitialSize

List of usage examples for org.apache.commons.dbcp BasicDataSource setInitialSize

Introduction

In this page you can find the example usage for org.apache.commons.dbcp BasicDataSource setInitialSize.

Prototype

public synchronized void setInitialSize(int initialSize) 

Source Link

Document

Sets the initial size of the connection pool.

Note: this method currently has no effect once the pool has been initialized.

Usage

From source file:org.apache.synapse.commons.datasource.factory.DataSourceFactory.java

/**
 * Factory method to create a DataSource based on provided information
 * which is encapsulated in the DataSourceInformation object.
 *
 * @param dataSourceInformation Information about DataSource
 * @return DataSource Instance if one can be created ,
 *         otherwise null or exception if provided details are not valid or enough to create
 *         a DataSource/*from w w w .  ja  v  a2s. co  m*/
 */
public static DataSource createDataSource(DataSourceInformation dataSourceInformation) {

    String dsType = dataSourceInformation.getType();
    String driver = dataSourceInformation.getDriver();

    if (driver == null || "".equals(driver)) {
        handleException("Database driver class name cannot be found.");
    }

    String url = dataSourceInformation.getUrl();

    if (url == null || "".equals(url)) {
        handleException("Database connection URL cannot be found.");
    }

    String user = dataSourceInformation.getSecretInformation().getUser();
    String password = dataSourceInformation.getSecretInformation().getResolvedSecret();

    int defaultTransactionIsolation = dataSourceInformation.getDefaultTransactionIsolation();

    if (DataSourceInformation.BASIC_DATA_SOURCE.equals(dsType)) {

        BasicDataSource basicDataSource = new BasicDataSource();
        basicDataSource.setDriverClassName(driver);
        basicDataSource.setUrl(url);

        if (user != null && !"".equals(user)) {
            basicDataSource.setUsername(user);
        }

        if (password != null && !"".equals(password)) {
            basicDataSource.setPassword(password);
        }

        basicDataSource.setMaxActive(dataSourceInformation.getMaxActive());
        basicDataSource.setMaxIdle(dataSourceInformation.getMaxIdle());
        basicDataSource.setMaxWait(dataSourceInformation.getMaxWait());
        basicDataSource.setMinIdle(dataSourceInformation.getMinIdle());
        basicDataSource.setDefaultAutoCommit(dataSourceInformation.isDefaultAutoCommit());
        basicDataSource.setDefaultReadOnly(dataSourceInformation.isDefaultReadOnly());
        basicDataSource.setTestOnBorrow(dataSourceInformation.isTestOnBorrow());
        basicDataSource.setTestOnReturn(dataSourceInformation.isTestOnReturn());
        basicDataSource.setTestWhileIdle(dataSourceInformation.isTestWhileIdle());
        basicDataSource.setMinEvictableIdleTimeMillis(dataSourceInformation.getMinEvictableIdleTimeMillis());
        basicDataSource
                .setTimeBetweenEvictionRunsMillis(dataSourceInformation.getTimeBetweenEvictionRunsMillis());
        basicDataSource.setNumTestsPerEvictionRun(dataSourceInformation.getNumTestsPerEvictionRun());
        basicDataSource.setMaxOpenPreparedStatements(dataSourceInformation.getMaxOpenPreparedStatements());
        basicDataSource.setAccessToUnderlyingConnectionAllowed(
                dataSourceInformation.isAccessToUnderlyingConnectionAllowed());
        basicDataSource.setInitialSize(dataSourceInformation.getInitialSize());
        basicDataSource.setPoolPreparedStatements(dataSourceInformation.isPoolPreparedStatements());

        if (defaultTransactionIsolation != -1) {
            basicDataSource.setDefaultTransactionIsolation(defaultTransactionIsolation);
        }

        String defaultCatalog = dataSourceInformation.getDefaultCatalog();
        if (defaultCatalog != null && !"".equals(defaultCatalog)) {
            basicDataSource.setDefaultCatalog(defaultCatalog);
        }

        String validationQuery = dataSourceInformation.getValidationQuery();

        if (validationQuery != null && !"".equals(validationQuery)) {
            basicDataSource.setValidationQuery(validationQuery);
        }

        return basicDataSource;

    } else if (DataSourceInformation.PER_USER_POOL_DATA_SOURCE.equals(dsType)) {

        DriverAdapterCPDS adapterCPDS = new DriverAdapterCPDS();

        try {
            adapterCPDS.setDriver(driver);
        } catch (ClassNotFoundException e) {
            handleException("Error setting driver : " + driver + " in DriverAdapterCPDS", e);
        }

        adapterCPDS.setUrl(url);

        if (user != null && !"".equals(user)) {
            adapterCPDS.setUser(user);
        }

        if (password != null && !"".equals(password)) {
            adapterCPDS.setPassword(password);
        }

        adapterCPDS.setPoolPreparedStatements(dataSourceInformation.isPoolPreparedStatements());
        adapterCPDS.setMaxIdle(dataSourceInformation.getMaxIdle());

        PerUserPoolDataSource perUserPoolDataSource = new PerUserPoolDataSource();
        perUserPoolDataSource.setConnectionPoolDataSource(adapterCPDS);

        perUserPoolDataSource.setDefaultMaxActive(dataSourceInformation.getMaxActive());
        perUserPoolDataSource.setDefaultMaxIdle(dataSourceInformation.getMaxIdle());
        perUserPoolDataSource.setDefaultMaxWait((int) dataSourceInformation.getMaxWait());
        perUserPoolDataSource.setDefaultAutoCommit(dataSourceInformation.isDefaultAutoCommit());
        perUserPoolDataSource.setDefaultReadOnly(dataSourceInformation.isDefaultReadOnly());
        perUserPoolDataSource.setTestOnBorrow(dataSourceInformation.isTestOnBorrow());
        perUserPoolDataSource.setTestOnReturn(dataSourceInformation.isTestOnReturn());
        perUserPoolDataSource.setTestWhileIdle(dataSourceInformation.isTestWhileIdle());
        perUserPoolDataSource
                .setMinEvictableIdleTimeMillis((int) dataSourceInformation.getMinEvictableIdleTimeMillis());
        perUserPoolDataSource.setTimeBetweenEvictionRunsMillis(
                (int) dataSourceInformation.getTimeBetweenEvictionRunsMillis());
        perUserPoolDataSource.setNumTestsPerEvictionRun(dataSourceInformation.getNumTestsPerEvictionRun());

        if (defaultTransactionIsolation != -1) {
            perUserPoolDataSource.setDefaultTransactionIsolation(defaultTransactionIsolation);
        }

        String validationQuery = dataSourceInformation.getValidationQuery();

        if (validationQuery != null && !"".equals(validationQuery)) {
            perUserPoolDataSource.setValidationQuery(validationQuery);
        }

        return perUserPoolDataSource;

    } else {
        handleException("Unsupported DataSource : " + dsType);
    }
    return null;
}

From source file:org.apache.synapse.config.xml.AbstractDBMediatorFactory.java

/**
 * Create a custom DataSource using the specified properties and Apache DBCP
 * @param pool the toplevel 'pool' element that holds DataSource information
 * @param mediator the mediator to store properties for serialization
 * @return a DataSource created using specified properties
 *///from w w  w.j  av  a 2  s. com
private DataSource createCustomDataSource(OMElement pool, AbstractDBMediator mediator) {

    BasicDataSource ds = new BasicDataSource();

    // load the minimum required properties
    ds.setDriverClassName(getValue(pool, DRIVER_Q));
    ds.setUsername(getValue(pool, USER_Q));
    ds.setPassword(getValue(pool, PASS_Q));
    ds.setUrl(getValue(pool, URL_Q));

    //save loaded properties for later
    mediator.addDataSourceProperty(DRIVER_Q, getValue(pool, DRIVER_Q));
    mediator.addDataSourceProperty(URL_Q, getValue(pool, URL_Q));
    mediator.addDataSourceProperty(USER_Q, getValue(pool, USER_Q));
    mediator.addDataSourceProperty(PASS_Q, getValue(pool, PASS_Q));

    Iterator props = pool.getChildrenWithName(PROP_Q);
    while (props.hasNext()) {

        OMElement prop = (OMElement) props.next();
        String name = prop.getAttribute(ATT_NAME).getAttributeValue();
        String value = prop.getAttribute(ATT_VALUE).getAttributeValue();
        // save property for later
        mediator.addDataSourceProperty(name, value);

        if ("autocommit".equals(name)) {
            if ("true".equals(value)) {
                ds.setDefaultAutoCommit(true);
            } else if ("false".equals(value)) {
                ds.setDefaultAutoCommit(false);
            }
        } else if ("isolation".equals(name)) {
            try {
                if ("Connection.TRANSACTION_NONE".equals(value)) {
                    ds.setDefaultTransactionIsolation(Connection.TRANSACTION_NONE);
                } else if ("Connection.TRANSACTION_READ_COMMITTED".equals(value)) {
                    ds.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
                } else if ("Connection.TRANSACTION_READ_UNCOMMITTED".equals(value)) {
                    ds.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
                } else if ("Connection.TRANSACTION_REPEATABLE_READ".equals(value)) {
                    ds.setDefaultTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
                } else if ("Connection.TRANSACTION_SERIALIZABLE".equals(value)) {
                    ds.setDefaultTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
                }
            } catch (NumberFormatException ignore) {
            }
        } else if ("initialsize".equals(name)) {
            try {
                ds.setInitialSize(Integer.parseInt(value));
            } catch (NumberFormatException ignore) {
            }
        } else if ("maxactive".equals(name)) {
            try {
                ds.setMaxActive(Integer.parseInt(value));
            } catch (NumberFormatException ignore) {
            }
        } else if ("maxidle".equals(name)) {
            try {
                ds.setMaxIdle(Integer.parseInt(value));
            } catch (NumberFormatException ignore) {
            }
        } else if ("maxopenstatements".equals(name)) {
            try {
                ds.setMaxOpenPreparedStatements(Integer.parseInt(value));
            } catch (NumberFormatException ignore) {
            }
        } else if ("maxwait".equals(name)) {
            try {
                ds.setMaxWait(Long.parseLong(value));
            } catch (NumberFormatException ignore) {
            }
        } else if ("minidle".equals(name)) {
            try {
                ds.setMinIdle(Integer.parseInt(value));
            } catch (NumberFormatException ignore) {
            }
        } else if ("poolstatements".equals(name)) {
            if ("true".equals(value)) {
                ds.setPoolPreparedStatements(true);
            } else if ("false".equals(value)) {
                ds.setPoolPreparedStatements(false);
            }
        } else if ("testonborrow".equals(name)) {
            if ("true".equals(value)) {
                ds.setTestOnBorrow(true);
            } else if ("false".equals(value)) {
                ds.setTestOnBorrow(false);
            }
        } else if ("testonreturn".equals(name)) {
            if ("true".equals(value)) {
                ds.setTestOnReturn(true);
            } else if ("false".equals(value)) {
                ds.setTestOnReturn(false);
            }
        } else if ("testwhileidle".equals(name)) {
            if ("true".equals(value)) {
                ds.setTestWhileIdle(true);
            } else if ("false".equals(value)) {
                ds.setTestWhileIdle(false);
            }
        } else if ("validationquery".equals(name)) {
            ds.setValidationQuery(value);
        }
    }
    return ds;
}

From source file:org.apache.wookie.server.Start.java

private static void configureServer() throws Exception {
    // create embedded jetty instance
    logger.info("Configuring Jetty server");
    server = new Server(port);

    // configure embedded jetty to handle wookie web application
    WebAppContext context = new WebAppContext();
    context.setServer(server);/*  w w w .  j  a v a2  s  .  co  m*/
    context.setContextPath("/wookie");
    context.setWar("build/webapp/wookie");

    // enable and configure JNDI container resources
    context.setConfigurationClasses(new String[] { "org.mortbay.jetty.webapp.WebInfConfiguration",
            "org.mortbay.jetty.plus.webapp.EnvConfiguration", "org.mortbay.jetty.plus.webapp.Configuration",
            "org.mortbay.jetty.webapp.JettyWebXmlConfiguration",
            "org.mortbay.jetty.webapp.TagLibConfiguration" });
    if (persistenceManagerType.equals(PERSISTENCE_MANAGER_TYPE_JPA)) {
        logger.info("Configuring JPA persistence manager");

        // setup derby database directory and logging properties
        if (dbType.equals("derby") && dbUri.startsWith("jdbc:derby:")) {
            int dbUriArgsIndex = dbUri.indexOf(";", 11);
            if (dbUriArgsIndex == -1) {
                dbUriArgsIndex = dbUri.length();
            }
            String databasePath = dbUri.substring(11, dbUriArgsIndex);
            int databaseDirIndex = databasePath.lastIndexOf(File.separatorChar);
            if ((databaseDirIndex == -1) && (File.separatorChar != '/')) {
                databaseDirIndex = databasePath.lastIndexOf('/');
            }
            if (databaseDirIndex != -1) {
                String databaseDir = databasePath.substring(0, databaseDirIndex);
                File databaseDirFile = new File(databaseDir);
                if (!databaseDirFile.exists()) {
                    databaseDirFile.mkdirs();
                }
                String derbyLog = databaseDirFile.getAbsolutePath() + File.separator + "derby.log";
                System.setProperty("derby.stream.error.file", derbyLog);
            }
        }

        // Setup a database connection resource using DBCP
        BasicDataSource dataSource = new BasicDataSource();
        dataSource.setDriverClassName(dbDriver);
        dataSource.setUrl(dbUri);
        dataSource.setUsername(dbUser);
        dataSource.setPassword(dbPassword);
        dataSource.setMaxActive(80);
        dataSource.setMaxIdle(80);
        dataSource.setInitialSize(5);
        dataSource.setMaxOpenPreparedStatements(0);

        // Set up connection pool
        GenericObjectPool pool = new GenericObjectPool();
        // setup factory and pooling DataSource
        DataSourceConnectionFactory factory = new DataSourceConnectionFactory(dataSource);
        @SuppressWarnings("unused")
        PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(factory, pool, null,
                null, false, true);
        DataSource poolingDataSource = new PoolingDataSource(pool);

        new Resource(JPAPersistenceManager.WIDGET_DATABASE_JNDI_DATASOURCE_NAME, poolingDataSource);
    } else if (persistenceManagerType.equals(PERSISTENCE_MANAGER_TYPE_JCR)) {
        logger.info("Configuring JCR persistence manager");

        // setup repository directory and derby logging properties
        File repositoryDirFile = new File("widgetRepository");
        if (!repositoryDirFile.exists()) {
            repositoryDirFile.mkdirs();
        }
        String derbyLog = repositoryDirFile.getAbsolutePath() + File.separator + "derby.log";
        System.setProperty("derby.stream.error.file", derbyLog);

        // setup Jackrabbit JCR repository JNDI resource
        String repositoryConfig = repositoryDirFile.getAbsolutePath() + File.separator + "repository.xml";
        Repository repository = new TransientRepository(repositoryConfig, repositoryDirFile.getAbsolutePath());
        new Resource(JCRPersistenceManager.WIDGET_REPOSITORY_JNDI_REPOSITORY_NAME, repository);
    }

    // configure embedded jetty web application handler
    server.addHandler(context);

    // configure embedded jetty authentication realm
    HashUserRealm authedRealm = new HashUserRealm("Authentication Required", "etc/jetty-realm.properties");
    server.setUserRealms(new UserRealm[] { authedRealm });

    logger.info("Configured Jetty server");
}

From source file:org.cambillaum.jpapersistor.persistence.configuration.PersistenceConfiguration.java

@Bean
public BasicDataSource dataSource() {
    BasicDataSource dataSource = new BasicDataSource();
    dataSource.setDriverClassName("org.hsqldb.jdbcDriver");
    dataSource.setUrl("jdbc:hsqldb:mem:testdb");
    dataSource.setUsername("sa");
    dataSource.setPassword("");
    dataSource.setInitialSize(0);
    dataSource.setMaxActive(15);// www  .  ja va  2s .c o m
    dataSource.setMaxIdle(0);
    dataSource.setMinEvictableIdleTimeMillis(60000);
    return dataSource;
}

From source file:org.compass.core.lucene.engine.store.jdbc.DbcpDataSourceProvider.java

protected DataSource doCreateDataSource(String url, CompassSettings settings) throws CompassException {
    BasicDataSource dataSource = new BasicDataSource();
    if (!externalAutoCommit) {
        dataSource.setDefaultAutoCommit(autoCommit);
    }/*from   w ww.  j  a v a  2  s  .c  om*/
    dataSource.setDriverClassName(driverClass);
    dataSource.setUrl(url);
    dataSource.setUsername(username);
    dataSource.setPassword(password);

    if (settings.getSetting(
            LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.DEFAULT_TRANSACTION_ISOLATION) != null) {
        dataSource.setDefaultTransactionIsolation(settings.getSettingAsInt(
                LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.DEFAULT_TRANSACTION_ISOLATION, 0));
    }

    if (settings.getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.INITIAL_SIZE) != null) {
        dataSource.setInitialSize(
                settings.getSettingAsInt(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.INITIAL_SIZE, 0));
    }

    if (settings.getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.MAX_ACTIVE) != null) {
        dataSource.setMaxActive(
                settings.getSettingAsInt(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.MAX_ACTIVE, 0));
    }

    if (settings.getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.MAX_IDLE) != null) {
        dataSource.setMaxIdle(
                settings.getSettingAsInt(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.MAX_IDLE, 0));
    }

    if (settings.getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.MIN_IDLE) != null) {
        dataSource.setMinIdle(
                settings.getSettingAsInt(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.MIN_IDLE, 0));
    }

    if (settings.getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.MAX_WAIT) != null) {
        dataSource.setMaxWait(
                settings.getSettingAsLong(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.MAX_WAIT, 0));
    }

    if (settings.getSetting(
            LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.MAX_OPEN_PREPARED_STATEMENTS) != null) {
        dataSource.setMaxOpenPreparedStatements(settings.getSettingAsInt(
                LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.MAX_OPEN_PREPARED_STATEMENTS, 0));
    }

    if (settings
            .getSetting(LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.POOL_PREPARED_STATEMENTS) != null) {
        dataSource.setPoolPreparedStatements(settings.getSettingAsBoolean(
                LuceneEnvironment.JdbcStore.DataSourceProvider.Dbcp.POOL_PREPARED_STATEMENTS, false));
    }

    return dataSource;
}

From source file:org.ff4j.test.utils.JdbcTestHelper.java

/**
 * Initialize DataSource with a pool of connections to HQL database.
 *
 * @return// w w  w.ja  v a2  s  . com
 *      current data source
 */
public static DataSource createInMemoryHQLDataSource() {
    // Init DataSource
    BasicDataSource dbcpDataSource = new BasicDataSource();
    dbcpDataSource.setDriverClassName("org.hsqldb.jdbcDriver");
    dbcpDataSource.setUsername("sa");
    dbcpDataSource.setPassword("");
    dbcpDataSource.setUrl("jdbc:hsqldb:mem:.");
    dbcpDataSource.setMaxActive(3);
    dbcpDataSource.setMaxIdle(2);
    dbcpDataSource.setInitialSize(2);
    dbcpDataSource.setValidationQuery("select 1 from INFORMATION_SCHEMA.SYSTEM_USERS;");
    dbcpDataSource.setPoolPreparedStatements(true);
    return dbcpDataSource;
}

From source file:org.jfaster.mango.support.DataSourceConfig.java

public static DataSource getDataSource(int i) {
    String driverClassName = getDriverClassName(i);
    String url = getUrl(i);//w ww.  j  a va 2 s.c  o m
    String username = getUsername(i);
    String password = getPassword(i);

    BasicDataSource ds = new BasicDataSource();
    ds.setUrl(url);
    ds.setUsername(username);
    ds.setPassword(password);
    ds.setInitialSize(1);
    ds.setMaxActive(1);
    ds.setDriverClassName(driverClassName);
    return ds;
}

From source file:org.lucane.server.database.DatabaseAbstractionLayer.java

/**
 * DatabaseLayer Factory//from w w w. java2s  .com
 * Get the layer corresponding to the driver
 */
public static DatabaseAbstractionLayer createLayer(ServerConfig config) throws Exception {
    Class.forName(config.getDbDriver());

    BasicDataSource ds = new BasicDataSource();
    ds.setDriverClassName(config.getDbDriver());
    ds.setUsername(config.getDbLogin());
    ds.setPassword(config.getDbPassword());
    ds.setUrl(config.getDbUrl());

    ds.setPoolPreparedStatements(true);
    ds.setInitialSize(config.getDbPoolInitialSize());
    ds.setMaxActive(config.getDbPoolMaxActive());
    ds.setMaxIdle(config.getDbPoolMaxIdle());
    ds.setMinIdle(config.getDbPoolMinIdle());
    ds.setMaxWait(config.getDbPoolMaxWait());

    Logging.getLogger()
            .info("Pool initialized (" + "initial size=" + config.getDbPoolInitialSize() + ", max active="
                    + config.getDbPoolMaxActive() + ", max idle=" + config.getDbPoolMaxIdle() + ", min idle="
                    + config.getDbPoolMinIdle() + ", max wait=" + config.getDbPoolMaxWait() + ")");

    //-- dynamic layer loading
    Class klass = Class.forName(config.getDbLayer());
    Class[] types = { DataSource.class };
    Object[] values = { ds };
    Constructor constr = klass.getConstructor(types);
    return (DatabaseAbstractionLayer) constr.newInstance(values);
}

From source file:org.midao.jdbc.core.pool.MjdbcPoolBinder.java

/**
 * Returns new Pooled {@link DataSource} implementation
 *
 * In case this function won't work - use {@link #createDataSource(java.util.Properties)}
 *
 * @param driverClassName Driver Class name
 * @param url Database connection url//  w w  w  . j av a2  s . c o  m
 * @param userName Database user name
 * @param password Database user password
 * @param initialSize initial pool size
 * @param maxActive max connection active
 * @return new Pooled {@link DataSource} implementation
 * @throws SQLException
 */
public static DataSource createDataSource(String driverClassName, String url, String userName, String password,
        int initialSize, int maxActive) throws SQLException {
    assertNotNull(driverClassName);
    assertNotNull(url);
    assertNotNull(userName);
    assertNotNull(password);

    BasicDataSource ds = new BasicDataSource();
    ds.setDriverClassName(driverClassName);
    ds.setUrl(url);
    ds.setUsername(userName);
    ds.setPassword(password);

    ds.setMaxActive(maxActive);
    ds.setInitialSize(initialSize);

    return ds;
}

From source file:org.nebula.service.core.DynamicDataSource.java

public void onChange(String dbUrl) {

    logger.info("Change target dbUrl to: " + dbUrl);

    Object oldDataSource = this.datasources.remove(LOOKUP_KEY);

    if (oldDataSource != null) {
        try {/*w w  w .j a  v a  2s.c  o  m*/
            ((BasicDataSource) oldDataSource).close();
        } catch (SQLException e) {
            //ignore
        }
    }

    BasicDataSource dataSource = new BasicDataSource();
    dataSource.setDriverClassName("com.mysql.jdbc.Driver");
    dataSource.setMaxActive(jdbcMaxActive);
    dataSource.setMaxIdle(jdbcMaxIdle);
    dataSource.setInitialSize(jdbcInitialSize);
    dataSource.setUrl(dbUrl);
    dataSource.setUsername(jdbcUsername);
    dataSource.setPassword(jdbcPassword);
    dataSource.setTestOnBorrow(true);
    dataSource.setValidationQuery("SELECT 1");

    this.datasources.put(LOOKUP_KEY, dataSource);
}