Search in sources :

Example 1 with DfConnectionCreationHook

use of org.dbflute.helper.jdbc.connection.DfConnectionCreationHook in project dbflute-core by dbflute.

the class DfTaskControlLogic method setupDataSource.

// ===================================================================================
// Data Source
// ===========
public void setupDataSource() throws SQLException {
    final DfDataSourceHandler dataSourceHandler = _databaseResource.getDataSourceHandler();
    dataSourceHandler.setUser(_databaseResource.getUser());
    dataSourceHandler.setPassword(_databaseResource.getPassword());
    dataSourceHandler.setDriver(_databaseResource.getDriver());
    dataSourceHandler.setUrl(_databaseResource.getUrl());
    dataSourceHandler.setConnectionProperties(_databaseResource.getConnectionProperties());
    dataSourceHandler.setAutoCommit(true);
    dataSourceHandler.addConnectionCreationHook(new DfConnectionCreationHook() {

        public void hook(Connection conn) throws SQLException {
            connectMainSchema(conn);
        }
    });
    dataSourceHandler.prepare();
}
Also used : SQLException(java.sql.SQLException) Connection(java.sql.Connection) DfConnectionCreationHook(org.dbflute.helper.jdbc.connection.DfConnectionCreationHook) DfDataSourceHandler(org.dbflute.helper.jdbc.connection.DfDataSourceHandler)

Aggregations

Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 DfConnectionCreationHook (org.dbflute.helper.jdbc.connection.DfConnectionCreationHook)1 DfDataSourceHandler (org.dbflute.helper.jdbc.connection.DfDataSourceHandler)1