Exception on FlatXmlDataSet.write

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Exception on FlatXmlDataSet.write

Loïc Lacombe-2
Hi,
I've just met the following exception when I tried to dump my database with dbunit 2.4.5:
org.dbunit.dataset.DataSetException: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'End'. at org.dbunit.database.DatabaseDataSet.getTable(DatabaseDataSet.java:316) at org.dbunit.dataset.filter.SequenceTableIterator.getTable(SequenceTableIterator.java:77) 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 com.transatel.vigor.commons.transaction.TransactionAdaptorImplTest.dumpDatabase(TransactionAdaptorImplTest.java:111) at com.transatel.vigor.commons.transaction.TransactionAdaptorImplTest.testCreateSingleTransaction(TransactionAdaptorImplTest.java:97) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'End'. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source) at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerStatement.sendExecute(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteQuery(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeQuery(Unknown Source) 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) ... 30 more

So far, it seems like DbUnit generated an incorrect statement when trying to dump the db. I use SQL Server 2005 as a db server and I could dump the database content with the same code, earlier :
private void dumpDatabase() throws Exception { IDatabaseConnection conn = dbTester.getConnection(); ITableFilter filter = new DatabaseSequenceFilter(conn); IDataSet dbDataSet = new FilteredDataSet(filter, conn.createDataSet()); File dtdFile = new File(DTD); FlatDtdDataSet.write(dbDataSet, new FileOutputStream(dtdFile)); LOG.info("Dumped database dtd to " + dtdFile.getCanonicalPath()); File xmlFile = new File(DATASET_XML); FlatXmlDataSet.write(dbDataSet, new FileOutputStream(xmlFile)); LOG.info("Dumped database dataset to " + xmlFile.getCanonicalPath()); }


Do you have any idea of what could cause this?

TIA

Loïc Lacombe



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user