I use dbunit to create database backups that can be imported and exported. My application can use several database mechanisms: MySQL, PostgreSQL, SQLServer, H2 and Oracle.
All of the above works fine with the following code:
// Connect to the database conn =BackupManager.getInstance().getConnection(); IDatabaseConnection connection = new DatabaseConnection(conn); InputSource xmlSource = new InputSource(new FileInputStream(new File(nameXML))); FlatXmlProducer flatXmlProducer = new FlatXmlProducer(xmlSource); flatXmlProducer.setColumnSensing(true); DatabaseOperation.CLEAN_INSERT.execute(connection,new FlatXmlDataSet(flatXmlProducer));
But in Oracle, I get this exception:
!ENTRY es.giro.girlabel.backup 1 0 2012-04-11 11:51:40.542 !MESSAGE Start import backup org.dbunit.database.AmbiguousTableNameException: AQ$_SCHEDULES at org.dbunit.dataset.OrderedTableNameMap.add(OrderedTableNameMap.java:198) at org.dbunit.database.DatabaseDataSet.initialize(DatabaseDataSet.java:231) at org.dbunit.database.DatabaseDataSet.getTableMetaData(DatabaseDataSet.java:281) at org.dbunit.operation.DeleteAllOperation.execute(DeleteAllOperation.java:109) at org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79) at es.giro.girlabel.backup.ImportBackup.createData(ImportBackup.java:39) at es.giro.girlabel.backup.handlers.Import.execute(Import.java:45)
source share