JasperReports 在生成报告之前是否读取列元数据?

发布于 2024-08-15 15:46:42 字数 630 浏览 6 评论 0原文

我制作了一些 JasperReports,并且在 Windows 机器上运行得很好。当报告被设置为在具有 zOS 操作系统的大型机上运行时,问题就出现了。

问题是:当 Jasper 创建报告时,它似乎从数据库中读取表元数据,并基于它期望数据出现。
示例:如果我有一个 varchar(20) 类型的列,那么即使报告字段定义为字符串,Jasper 也只会等待 20 个字符。

在 Windows 环境中不会发生这种情况,但在大型机上,字符编码是 EBCDIC,因此该列在大型机上可能有 19 个字符,但在编码时,它会以 23 或 24 个字符返回到报告。

注意:此问题仅出现在非英文字符中。

更新
当 Jasper 创建报告时,会引发 ConversionBufferFull ,因为我无法访问大型机日志,所以我没有完整的跟踪。仅当名为 COUNTRY_DESC 的一列的值约为 17-20 个字符时,就会出现该问题,并且会发生异常。

正如我提到的,大型机上的字符集是 EBCDIC,但是当它通过 JDBC 读取时,它会转换为 Unicode。例如,在 EBCDIC 中,该单词将是 17 个字符,但转换后它会变成 22 个。出于某种奇怪的原因,Jasper 只期望该字段为 20 个字符。

I have a few JasperReports made and running very fine on a Windows machine. The problem started when the reports were set to run on a mainframe with zOS operating system.

The problem is: when Jasper creates the report it seems to read the tables metadata from the database and based on it expect the data to come.
Example: if i have a column of type varchar(20), then Jasper will be waiting for 20 chars only even if the report field is defined as String.

That doesn't happen in Windows environment, but on the mainframe the character-encoding is EBCDIC, and so the column might have 19 chars on the mainframe, but when encoded its returned to the report as 23 or 24 characters.

Note: this problem only occurs in non-English characters.

UPDATE
A ConversionBufferFull is thrown when Jasper is creating the report, i don't have the full trace since i can't access the mainframe log. The problem occurs with only one column called COUNTRY_DESC when the value is around 17-20 chars, the exception occurs.

As i mentioned the character set on the mainframe is EBCDIC, but when its read through the JDBC its converted to Unicode. for example in EBCDIC the word will be 17 chars, but when converted it become 22. For some strange reason Jasper expects 20 for this field only.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你爱我像她 2024-08-22 15:46:42

JasperReports 本身不管理数据转换,也不管理字段长度。这看起来像是 JDBC 驱动程序的问题。

谢尔曼
贾斯珀软件公司

JasperReports itself does not manage the data conversion, nor the field length. This looks like an issue with the JDBC driver.

Sherman
Jaspersoft

愿与i 2024-08-22 15:46:42

sun.io.ConversionBufferFullExceptionsun.io 字符编码转换器抛出,并且可能通过旧版本 Java 中的 java.io 类冒泡。此 API 已被弃用一段时间,并且自 Java 6 - java.nio.charset 被使用以来不再使用。

这是 JasperReports、您的 JDBC 驱动程序或这两者使用的东西中的字符转换错误。我认为这与从 JDBC ResultSet 本身读取元数据没有任何关系,尽管元数据中的字符串可能被错误转换。

如果没有堆栈跟踪,很难归咎于问题或想出解决方法。

sun.io.ConversionBufferFullException is thrown by sun.io character encoding converters and may bubble up through java.io classes in older versions of Java. This API has been deprecated for some time and is no longer in use since Java 6 - java.nio.charset is used instead.

It is a character conversion bug in either JasperReports, your JDBC driver or things used by those two. I don't think it has anything to do with reading meta-data from the JDBC ResultSet per se, although it might be the strings in the meta-data that is incorrectly converted.

It's hard to place the blame or think up a work-around without the stack trace.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文