QueryDataSet doesn't return DataSet using Oracle db

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

QueryDataSet doesn't return DataSet using Oracle db

Sergii Kartashov
Hello ladies and gentlemens,

I'm trying to use DBUnit library for execute delete items(records) in my database (Oracle) DatabaseOperation.DELETE.execute(connection, items);. 
I have created the simple method. At this moment I'm trying remove items (stored to my resource - xml file):

import java.sql.Connection;
    public void cleanAndInitTables(Connection con, String[] resources, String defaultSchema) throws Exception {
        FlatXmlDataSetBuilder dataSet = new FlatXmlDataSetBuilder();
        try {
            for (int i = 0; i < resources.length; i++) {
                IDataSet items =
                IDatabaseConnection dbUnit = new OracleConnection(con, defaultSchema);
                DatabaseConfig config = dbUnit.getConfig();
                config.setProperty(DatabaseConfig.FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES, Boolean.valueOf(true)); 
                config.setProperty(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, Boolean.valueOf(true));
                DatabaseOperation.DELETE.execute(dbUnit, items);
//                DatabaseOperation.INSERT.execute(dbUnit, items);
        } finally {

I'm getting connection with help this simple methods:

    public static Connection getSimpleConnection(String driver, String url, String user, String pass) {

        Connection result = null;
        try {
        catch (Exception ex){

        try {
          result = DriverManager.getConnection(url, user, pass);
        catch (SQLException e){
        return result;

And I have got ERROR message:

ERROR org.dbunit.database.DatabaseDataSet - Table 'my_table' not found in tableMap=org.dbunit.dataset.OrderedTableNameMap[_tableNames=[SCHEMA.SOME_TABLE, SCHEMA.MY_TABLE]

String[] conPropMySQL = {"com.mysql.jdbc.Driver", "jdbc:mysql://localhost:3306/db_name", "root", ""};
String[] conPropOracle = {"oracle.jdbc.OracleDriver", "jdbc:oracle:thin:@" , "user", "pass"};

Some logs:

DEBUG org.dbunit.util.SQLHelper - isEscaped returns 'false' for tableName=MY_SCHEMA (dbIdentifierQuoteString=")
DEBUG org.dbunit.database.DatabaseConnection - Database connection info: 
database product name=Oracle
database version=Oracle Database 10g Enterprise Edition Release - 64bit Production
With the Partitioning, OLAP and Data Mining options
database major version=10
database minor version=2
jdbc driver name=Oracle JDBC driver
jdbc driver version=
jdbc driver major version=11
jdbc driver minor version=1

I also tried it with JdbcDatabaseTester - define schema. But I have got the same result.

Of cause, I can use sql scripts and clean my data very vell without this library. But I read that this lib can do it too. 
Please help me if you can. I want to use this library.

Serhii K.

Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
dbunit-user mailing list
[hidden email]