我有以下 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>
当我运行导出目标时,它失败并出现 sql 异常,指出未找到该表。但是,如果我将表名称从 tablename
更改为 myschemaname.tablename
并删除 schema
节点导出可以正常工作。即使我不删除 schema 节点,它也可以正常工作,因此它不会因 myschemaname.tablename
表名而失败。
配置有什么问题?
最佳答案
尝试将 useQualifiedTableNames 设置为 false:
<useQualifiedTableNames>false</useQualifiedTableNames>
查看 dbunit maven 插件文档 here .
更新:
如果您使用Oracle 10g,您可能需要启用 skipOracleRecycleBinTables还有:
<skipOracleRecycleBinTables>true</skipOracleRecycleBinTables>
如 DBUnit 文档 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.
希望这有帮助。
关于java - dbunit 模式参数不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9538961/