0

我想将我的数据库提取到 FlatXmlDataSet。我使用本教程: http ://www.dbunit.org/faq.html#extract

我的代码看起来:

Class driverClass = Class.forName("oracle.jdbc.driver.OracleDriver");
Connection jdbcConnection = DriverManager.getConnection(
            "jdbc:oracle:thin: <my parametres>", "<user>", "<password>");
IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);

// full database export
IDataSet fullDataSet = connection.createDataSet();
FlatXmlDataSet.write(fullDataSet, new FileOutputStream("full.xml"));

我有错误:

Exception in thread "main" org.dbunit.dataset.DataSetException:java.sql.SQLSyntaxErrorException: 
ORA-00942: table or view does not exist

at org.dbunit.database.DatabaseDataSet.getTable(DatabaseDataSet.java:316)
at org.dbunit.database.DatabaseTableIterator.getTable(DatabaseTableIterator.java:89)
at org.dbunit.dataset.stream.DataSetProducerAdapter.produce(DataSetProducerAdapter.java:83)
at org.dbunit.dataset.xml.FlatXmlWriter.write(FlatXmlWriter.java:124)
at org.dbunit.dataset.xml.FlatXmlDataSet.write(FlatXmlDataSet.java:341)
at db.main(db.java:26)
Caused by: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:951)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:513)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:195)
at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:876)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1175)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1296)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1498)
at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:406)
at org.dbunit.database.AbstractResultSetTable.<init>(AbstractResultSetTable.java:110)
at org.dbunit.database.ForwardOnlyResultSetTable.<init>(ForwardOnlyResultSetTable.java:59)
at org.dbunit.database.CachedResultSetTableFactory.createTable(CachedResultSetTableFactory.java:60)
at org.dbunit.database.DatabaseDataSet.getTable(DatabaseDataSet.java:312)
... 5 more

我使用:-eclipse -dbunit 2.4.5 -slf4j 1.5.8 -maven 3.04

谢谢你的帮助

4

1 回答 1

0

首先,检查您的连接参数是否拼写正确,是否设置了必要的权限以及数据库中的表是否确实存在。然后,您可以查看类似的帖子java.sql.SQLSyntaxErrorException: ORA-00942

于 2013-09-12T11:22:05.870 回答