2008-09-11

DbUnit with Oracle

When using DbUnit with Oracle, the followings are recommened to avoid exceptions or something like that.
  • Provide the schema name when creating the database connection.
  • Use the OracleDataTypeFactory.
  • Disable FEATURE_QUALIFIED_TABLE_NAMES
  • Enable FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES
IDatabaseConnection conn = new OracleConnection(ds.getConnection(), "MYSCHEMA");
DatabaseConfig config = conn.getConfig();
config.setFeature(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, false);
config.setFeature(DatabaseConfig.FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES, true);
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new OracleDataTypeFactory());

2 comments:

Anonymous said...

Thank you very much for the solution, I could resolve AmbiguousTableNameException with DBUnit.

Thank you.

Peter Rafaj said...

I can only recommend the mentioned settings for Oracle. For us it solved mainly the performance issues of DBUnit on Oracle DB.

Post a Comment