Question

I am running the BIRT 4.3.2 report engine on an IBM WAS 8.5.5 server.

The reports load fine when there are actually results for the given criteria. I receive the following exception when there are no results:

org.eclipse.birt.data.engine.odaconsumer.ResultSet fetch
SEVERE: Cannot fetch the next data row.
Throwable occurred: org.eclipse.birt.report.data.oda.jdbc.JDBCException: Cannot move down to next row in the result set.
SQL error #1:Invalid operation: result set closed
com.ibm.db2.jcc.c.SqlException: Invalid operation: result set closed
    at org.eclipse.birt.report.data.oda.jdbc.ResultSet.next(ResultSet.java:198)

I am aware of this topic:

developer.actuate.com/community/forum/index.php?/topic/25148-exception-is-thrown-when-there-is-no-data-retreived-from-query/

Since my report data source simply defines the JDBC class com.ibm.db2.jcc.DB2Driver and JNDI URL, it uses the WAS data source. I did try adding the allowNextOnExhaustedResultSet custom property to the data source as an integer value 1, but this did not fix anything for me. This was stated to only be a work-around anyways.

I asked on the BIRT forum if this would be fixed, no response? As suggested by IBM- Modify the application code to avoid calling ResultSet.next if there are no records or no more records. This is in the BIRT data engine code, for ResultSet class.

Are there any more work-arounds in the mean time?

It's probably also worth mentioning that this was working without issue on BIRT 4.2.0

Was it helpful?

Solution 2

The answer is, this is probably a bug in the BIRT code and can be fixed hopefully by upgrading to a future version.

The work around I suggest, is based on my discovery of the root cause of the exception.

In 4.2.0, I used an aggregative expression inside of a grid element. Updated to 4.3.2, this is where and only when the exception occurs. To fix, I created the same layout and resulting report using a table element and same aggregation expression and no longer receive the exception on no results returned.

OTHER TIPS

Here is the fragment of code involved, in org.eclipse.birt.report.data.oda.jdbc.ResultSet.next

    try
    {
        /* redirect the call to JDBC ResultSet.next() */
        if ( currentRow < maxRows && rs.next( ) )
        {
            currentRow++;
            return true;
        }
        return false;
    }
    catch ( SQLException e )
    {
        throw new JDBCException(ResourceConstants.RESULTSET_CURSOR_DOWN_ERROR , e );
    }

As suggested in the link you provide, a "quick" workaround would be to check the state of the resultset in this "if" statement:

if ( currentRow < maxRows && !rs.isClosed() && rs.next( ) )
    {
        currentRow++;
        return true;
    }
return false;

Of course it requires to download the source code of BIRT in Eclipse, there is an automated process for this. I know this is probably not the kind of solution you expect, but it might be the only one. You don't have to compile the whole BIRT project, just export this class as a .jar and replace the old class in Eclipse and in your BIRT runtime environment.

it might be valuable to submit this as a patch in bugzilla of birt

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top