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

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

Introduction

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

Prototype

public void setLogWriter(PrintWriter logWriter) throws SQLException 

Source Link

Document

Sets the log writer being used by this data source.

Calls #createDataSource() , so has the side effect of initializing the connection pool.

Usage

From source file:org.tdmx.lib.control.datasource.DynamicDataSource.java

private synchronized void createDataSource(DatabaseConnectionInfo dci) throws SQLException {
    // race condition avoidance
    if (connectionDataSourceMap.get(dci) != null) {
        return;/* w ww  .jav  a 2s  . com*/
    }
    BasicDataSource bds = new BasicDataSource();
    bds.setUrl(dci.getUrl());
    bds.setDriverClassName(dci.getDriverClassname());
    bds.setUsername(dci.getUsername());
    bds.setPassword(dci.getPassword());
    bds.setMaxActive(100);
    bds.setMinIdle(0);
    bds.setInitialSize(1);
    bds.setMinEvictableIdleTimeMillis(60000);
    bds.setLogWriter(logWriter);
    connectionDataSourceMap.put(dci, bds);
}