Dbunit and schema case problem.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Dbunit and schema case problem.

Alex Sviridov
Hi all

I use h2 1.3.176 and dbunit 2.5.2. I want in h2 all not quoted names be as they are, but not to be converted to uppercase. After reading this information here http://stackoverflow.com/a/10793358/5057736 I added to my H2 URL the following: ;DATABASE_TO_UPPER=FALSE and  everything on h2
works as I expect. I have schema: mySchema and I have table: myTable.

To make dbunit work with original table name I use the following code:

       IDatabaseTester databaseTester = new JdbcDatabaseTester(ItConfiguration.JDBC_DRIVER,
        ItConfiguration.JDBC_URL, ItConfiguration.USER, ItConfiguration.PASSWORD,'mySchema');
        IDatabaseConnection dbUnitConn = databaseTester.getConnection();
        DatabaseConfig dbCfg = dbUnitConn.getConfig();
        dbCfg.setFeature(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, Boolean.TRUE);
        IDataSet iDataSet=new FlatXmlDataSetBuilder().build(new File(dataSetPath));
        DatabaseOperation.REFRESH.execute(dbUnitConn, iDataSet);

in xml file I have
       <myTable ..../>

However, I have problem with dbunit because because I can't make it use original case for schema name. In log I see:
org.apache.servicemix.bundles.dbunit[org.dbunit.util.SQLHelper] : class org.dbunit.database.DatabaseConnection. Corrected schema name: oldValue='mySchema' newValue='MYSCHEMA'....
org.apache.servicemix.bundles.dbunit[org.dbunit.operation.AbstractOperation] : getOperationMetaData(connection=org.dbunit.database.DatabaseConnection[schema='MYSCHEMA, connection=conn0: u....
org.dbunit.dataset.NoSuchTableException: myTable

Please, help me to solve this problem

Alex Sviridov
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
dbunit-user mailing list
[hidden email]