1

The problem is an existing Oracle table (that I cannot change) with mixed case column names, eg

create table BADTAB ( ID varchar(16) not null, "Name" varchar2(64),
       constraint I_BADTAB_PK PRIMARY KEY(ID) ); 

When I try to do a DBUnit INSERT from an XML dataset it fails

Caused by: java.sql.SQLException: ORA-00904: "NAME": invalid identifier

When I enclose the column name in quotes it fails

<column>"Name"</column>

org.dbunit.dataset.NoSuchColumnException: BADTAB."NAME" -  (Non-uppercase input column: "ReadingsPres") in ColumnNameToIndexes cache map.
    Note that the map's column names are NOT case sensitive.
    at org.dbunit.dataset.AbstractTableMetaData.getColumnIndex(AbstractTableMetaData.java:117)
    ...

QUESTION: How can I override DBUnit's column metadata to make it recognize the lowercase column name?
What classes do I override and how do I inject them into the DBUnit test run?

Andre
  • 390
  • 3
  • 8

1 Answers1

0

There have been some previous discussions around this org.dbunit.dataset.NoSuchTableException: Did not find table 'xxx' in schema 'null'

You should be able to set a database configuration property to cater for case-sensitive names:

DatabaseConfig config = databaseConnection.getConfig();
config.setProperty(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, true);
Community
  • 1
  • 1
craigcaulfield
  • 3,381
  • 10
  • 32
  • 40
  • Unfortunately this config for TABLE names does not resolve COLUMN names that are mixed case. – Andre Jul 10 '14 at 01:38