GenericJDBCException (invalid column index) with DBUnit & Oracle Express 11g XE

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

GenericJDBCException (invalid column index) with DBUnit & Oracle Express 11g XE


I'm using DBUnit 2.4.9 with version 1.6 of the Oracle JDBC driver against Oracle Express 11g and getting a GenericJDBCException which is causing my test to fail. The stack trace is this:

org.hibernate.exception.GenericJDBCException: Invalid column index
        at oracle.jdbc.driver.OracleResultSetImpl.getString(
        at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
        at org.hibernate.engine.jdbc.internal.proxy.AbstractResultSetProxyHandler.continueInvocation(
        at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(
        at $Proxy110.getString(Unknown Source)
        at org.dbunit.util.SQLHelper.createColumn(
        at org.dbunit.database.DatabaseTableMetaData.getColumns(
        at org.dbunit.dataset.AbstractTableMetaData.getColumnIndex(
        at org.dbunit.operation.AbstractOperation.getOperationMetaData(
        at org.dbunit.operation.AbstractBatchOperation.execute(

From what I can make out, the culprit are these lines of the SQLHelper.createColumn method:

        // This is only available since Java 5 - so we ca try it and if it does not work default it
        String isAutoIncrement = Column.AutoIncrement.NO.getKey();
        try {
            isAutoIncrement = resultSet.getString(23);
        catch(SQLException e){

The getString method is throwing a org.hibernate.exception.GenericJDBCException rather than an instance of SQLException, so it doesn't get caught by the block, bubbles up and causes the test to fail.

Any help/guidance much appreciated.

Many thanks