use of org.dbflute.helper.jdbc.connection.DfDataSourceHandler in project dbflute-core by dbflute.
the class DfSchemaSyncChecker method prepareTargetDataSource.
protected DataSource prepareTargetDataSource() {
final DfDataSourceHandler handler = new DfDataSourceHandler();
// inherit
handler.setDriver(getDatabaseProperties().getDatabaseDriver());
final String url = getDocumentProperties().getSchemaSyncCheckDatabaseUrl();
// may inherit
handler.setUrl(url);
final String user = getDocumentProperties().getSchemaSyncCheckDatabaseUser();
if (Srl.is_Null_or_TrimmedEmpty(user)) {
// just in case
String msg = "The user for sync target schema was not found: " + user;
throw new IllegalStateException(msg);
}
handler.setUser(user);
handler.setPassword(getDocumentProperties().getSchemaSyncCheckDatabasePassword());
// inherit
handler.setConnectionProperties(getDatabaseProperties().getConnectionProperties());
handler.setAutoCommit(true);
_log.info("...Preparing data source for SchemaSyncCheck target:");
_log.info(" url = " + url);
_log.info(" user = " + user);
return new DfFittingDataSource(handler);
}
use of org.dbflute.helper.jdbc.connection.DfDataSourceHandler 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();
}
use of org.dbflute.helper.jdbc.connection.DfDataSourceHandler in project dbflute-core by dbflute.
the class DfTaskControlLogic method commitDataSource.
public void commitDataSource() throws SQLException {
final DfDataSourceHandler dataSourceHandler = _databaseResource.getDataSourceHandler();
dataSourceHandler.commit();
}
use of org.dbflute.helper.jdbc.connection.DfDataSourceHandler in project dbflute-core by dbflute.
the class DfTaskControlLogic method destroyDataSource.
public void destroyDataSource() throws SQLException {
final DfDataSourceHandler dataSourceHandler = _databaseResource.getDataSourceHandler();
dataSourceHandler.destroy();
if (getDatabaseTypeFacadeProp().isDatabaseDerby()) {
// Derby(Embedded) needs an original shutdown for destroying a connection
DfDBFluteTaskUtil.shutdownIfDerbyEmbedded(_databaseResource.getDriver());
}
}
Aggregations