gpt4 book ai didi

数据集查询返回零结果时 BIRT 报告异常

转载 作者:行者123 更新时间:2023-12-01 21:09:17 25 4
gpt4 key购买 nike

我在 IBM WAS 8.5.5 服务器上运行 BIRT 4.3.2 报告引擎。

当给定条件实际有结果时,报告加载正常。当没有结果时,我收到以下异常:

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)

我知道这个主题:

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

由于我的报告数据源只是定义了 JDBC 类 com.ibm.db2.jcc.DB2DriverJNDI URL,因此它使用了 WAS 数据源 。我确实尝试将 allowNextOnExhaustedResultSet 自定义属性作为整数值 1 添加到数据源,但这并没有为我解决任何问题。无论如何,这只是一种解决方法。

我在 BIRT 论坛上问过这是否会被修复,没有回应?正如 IBM 所建议的那样,修改应用程序代码以避免在没有记录或没有更多记录时调用 ResultSet.next。这是 BIRT 数据引擎代码中的 ResultSet 类。

同时还有其他解决方法吗?

可能还值得一提的是,这在 BIRT 4.2.0

上运行没有问题

最佳答案

这里是涉及的代码片段,在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 );
}

如您提供的链接中所建议,“快速”解决方法是检查此“if”语句中结果集的状态:

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

当然需要在Eclipse中下载BIRT的源代码,这个有一个自动化的过程。我知道这可能不是您期望的解决方案,但它可能是唯一的解决方案。您不必编译整个 BIRT 项目,只需将此类导出为 .jar 并替换 Eclipse 和 BIRT 运行时环境中的旧类。

将其作为 birt bugzilla 中的补丁提交可能很有值(value)

关于数据集查询返回零结果时 BIRT 报告异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23496980/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com