How To Get DbUnit to See Aliases

How do I tell DbUnit to look at aliases as well as tables when searching the DatabaseMetaData?

There is a property on DatabaseConfig which allows you to set the "table types" it will use when querying for the JDBC tables metadata.
See the following example.

IDatabaseConnection dbUnitConnection = 
            new DatabaseConnection(jdbcConnection, schema);

        // by default, DbUnit only checks the catalog for tables.
        // since we use aliases, we will need to check these as well
        dbUnitConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_TABLE_TYPE,
            new String[] {"TABLE", "ALIAS"});
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License