use of org.dbunit.ext.h2.H2DataTypeFactory in project openmrs-core by openmrs.
the class BaseContextSensitiveTest method setupDatabaseConnection.
private IDatabaseConnection setupDatabaseConnection(Connection connection) throws DatabaseUnitException {
IDatabaseConnection dbUnitConn = new DatabaseConnection(connection);
if (useInMemoryDatabase()) {
// Setup the db connection to use H2 config.
DatabaseConfig config = dbUnitConn.getConfig();
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new H2DataTypeFactory());
}
return dbUnitConn;
}
use of org.dbunit.ext.h2.H2DataTypeFactory in project sharding-jdbc by shardingjdbc.
the class ShardingJdbcDatabaseTester method getConnection.
@Override
public IDatabaseConnection getConnection() throws Exception {
IDatabaseConnection result = super.getConnection();
DatabaseConfig dbConfig = result.getConfig();
dbConfig.setProperty(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, false);
dbConfig.setProperty(DatabaseConfig.FEATURE_DATATYPE_WARNING, false);
switch(driverClass) {
case "org.h2.Driver":
dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new H2DataTypeFactory());
break;
case "com.mysql.jdbc.Driver":
dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory());
break;
case "org.postgresql.Driver":
dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory());
break;
case "oracle.jdbc.driver.OracleDriver":
dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new Oracle10DataTypeFactory());
break;
case "com.microsoft.sqlserver.jdbc.SQLServerDriver":
dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MsSqlDataTypeFactory());
break;
default:
throw new ShardingJdbcException("Unsupported JDBC driver '%s'", driverClass);
}
return result;
}
Aggregations