Dbunit oracle导出错误

在用springside3.4的时候。把数据库迁移到oracle。修改了连接的一些参数。

执行数据库导出成文本文件的脚本。

报找不到表或者视图的错。是因为权限的关系

在oracle里面用system管理员登录

然后给用户权限

 

grant exp_full_database MINIWEB

 

 以为这样就可以了。没想到还是报错了。

 

org.dbunit.database 
Class AmbiguousTableNameException

查了一下文档上面的说明。是

 

This exception is thrown by IDataSet when multiple tables having the same name are accessible. This usually occurs when the database connection have access to multiple schemas containing identical table names.

Possible solutions: 1) Use a database connection credential that has access to only one database schema. 2) Specify a schema name to the DatabaseConnection orDatabaseDataSourceConnection constructor. 3) Enable the qualified table name support (see How-to documentation).

 

 


就是因为没有指明数据库的schema,这个schema默认是和用户名一样的。是一个空间。

类似建用户的时候,把用户建在一个命名空间一样。



修改dbunit的定义

加上schema 就可以了

 

	<target name="exp-db">
		<dbunit driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}" password="${jdbc.password}" schema="${oracle.schema}">
			<dbconfig>
				<property name="datatypeFactory" value="${dbunit.datatype}" />
			</dbconfig>
			<classpath refid="project.lib" />
			<export dest="${dbunit.data.dir}/export-data.xml" format="flat" />
		</dbunit>
	</target>
 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值