michael nesterenko
michael nesterenko

Reputation: 14439

dbunit schema parameter does not work

I have following configuration for dbunit

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>dbunit-maven-plugin</artifactId>
        <version>1.0-beta-3</version>
        <dependencies>
        <dependency>
         <groupId>ojdbc6</groupId>
             <artifactId>ojdbc6</artifactId>
             <version>1.0</version>
             <scope>system</scope>
             <systemPath>${project.basedir}/lib/ojdbc6.jar</systemPath>
         </dependency>
        </dependencies>
        <configuration>
            <driver>oracle.jdbc.driver.OracleDriver</driver>
            <url>jdbc:oracle:thin:@host.com:1521/user</url>
            <username>user</username>
            <password>password</password>
            <format>flat</format>
            <schema>myschemaname</schema>
            <useQualifiedTableNames>true</useQualifiedTableNames> 
            <tables>
                <table>
                    <name>tablename</name>
                </table>
            </tables>
         </configuration>
    </plugin>

When I run export goal, it fails with sql exception stating that table is not found. However if I change table name from tablename to myschemaname.tablename and remove schema node export works correctly. Even if I do not remove schema node it works correctly, so it just does not fail with myschemaname.tablename table name.

What is wrong with the configuration?

Upvotes: 0

Views: 1061

Answers (1)

yorkw
yorkw

Reputation: 41126

Try set useQualifiedTableNames to false:

<useQualifiedTableNames>false</useQualifiedTableNames> 

Check out the dbunit maven plugin documentation here.

UPDATE:
if you use Oracle 10g, you probably need enable skipOracleRecycleBinTables as well:

<skipOracleRecycleBinTables>true</skipOracleRecycleBinTables> 

As stated in DBUnit doc here:

Skip Oracle 10g Recyclebin tables

Enable or disable the processing of oracle recycle bin tables (tables starting with BIN$). Oracle 10g recyle bin tables may break DbUnit's assumption of tables name uniqueness within a schema since these table are case sensitive. Enable this feature for Oracle 10g databases until the bug in the oracle driver is fixed, which incorrectly reports this system tables to DbUnit.

Hope this helps.

Upvotes: 1

Related Questions