private DatabaseDialect createDialect(DataSource ds, WorkflowRepository wfRepository, EngineIdProvider engineIdProvider) throws SQLException {
Connection c = ds.getConnection();
try {
String name = c.getMetaData().getDatabaseProductName();
if ("oracle".equalsIgnoreCase(name)) {
OracleDialect dialect = new OracleDialect();
dialect.setWfRepository(wfRepository);
dialect.setEngineIdProvider(engineIdProvider);
dialect.setMultiEngineMode(false);
return dialect;
}
if ("Apache Derby".equalsIgnoreCase(name)) {
DerbyDbDialect dialect = new DerbyDbDialect();
dialect.setDataSource(ds);
dialect.setWfRepository(wfRepository);
return dialect;
}
throw new Error("No dialect available for DBMS "+name);
}
finally {