Showing posts with label DbUnit. Show all posts
Showing posts with label DbUnit. Show all posts

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());

2008-08-18

Using Keyword with Table Name and DbUnit

DbUnit 2.2 doesn't support automatic identifier quotation for auto generated DDLs or DMLs.

So, using with MySQL where table name may be keyword like 'order', 'lower-case-table-names' system variable of MySQL should be set to '0' on Unix or '2' on Windows and FEATURE_QUALIFIED_TABLE_NAMES of DbUnit should be set to 'true'.

Note that 'lower-case-table-names' is not dynamic variable, so it should be set at start-up like using my.ini.