Getting a fetch size exception while exporting partial database

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

Getting a fetch size exception while exporting partial database

iplazlac
This post was updated on .
Hi all. First of all i'm using a MS Access database. I've seen that's not listed in the supported databases for dbunit. Maybe that's the problem. I know Access is not the best database (probably the worst) but my DB is very simple, just one table, no relations.
The problem is i'm getting an exception i don't know how to fix, i'm new to dbunit.

    public DataBaseExport() throws Exception {
        // database connection
        Properties props = new Properties(); //Esto es tema de los caracteres, no hace falta.
        props.put("charSet", "iso-8859-1");
        props.put("user", "admin");
        props.put("password", "admin");
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        String url = "jdbc:odbc:prueba.mdb";
        Connection jdbcConnection = DriverManager.getConnection(url, props);
        IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);
        // partial database export
        DatabaseConfig dbconf = connection.getConfig();
        dbconf.setProperty(dbconf.PROPERTY_FETCH_SIZE,1000);
        QueryDataSet partialDataSet = new QueryDataSet(connection);
        partialDataSet.addTable("tabla", "select * from tabla where Categoria= 'Bar'");
        ITableIterator iter = partialDataSet.iterator();
->     FlatXmlDataSet.write(partialDataSet, new FileOutputStream("BBDDtest.xml"));
        //connection.close(); ?needed?

    }

In that line, atXmlDataSet.write(partialDataSet, new FileOutputStream("BBDDtest.xml")); i'm getting :
Exception in constructor: testCerrarConexion (org.dbunit.dataset.DataSetException: java.sql.SQLException: Invalid Fetch Size

Any idea of what could I be doing wrong?
Thanks in advance.