pentaho 在对中文query过滤时候报500错误,如何解决?

在使用Pentaho时遇到一个500错误,问题出现在对包含中文的SQL查询上。尽管SQL在客户端能够正确查询,但在控制台和日志中显示结果为0,并报错。分析认为是字符集编码导致的问题,尽管数据库、表和行编码都设置为utf8,但在Pentaho数据源配置中设置characterEncoding无效。替换中文为英文后,查询恢复正常。通过开启mondrian.log和mondrian_mdx.log日志,以及启动Pentaho的debug模式,发现查询可以正常运行,但尚未找到问题的根本原因。

SQL语句通过日志拿到,在客户端可以查询到结果。


但是在控制台打印日志发现返回结果为0

pentaho.log也进行了报错。

页面报500错误,


这样看应该是字符集编码的问题,数据库和表以及行俺都是utf8,在pentaho配置数据源option没有配置characterEncoding, 如果进行了设置还是报参数无效。


如果把云南省替换成 英文就没有问题可以进行过滤查询。


通过log4j.xml带开了mondrian.log和mondrian_mdx.log,另外启动pentaho采用了debug方式 ./start-pentaho-debug.sh ,查询竟然正常了。目前没有发现什么规律。

2014-03-25 10:06:51,504 DEBUG [mondrian.sql] 15: SqlTupleReader.readTuples [[Agent.Default].[Agent Code]]: executing sql [select `t_data_place_cater_order`.`agent_code` as `c0` from `t_data_place_cater_order` as `t_data_place_cater_order`, `t_dim_business` as `t_dim_business` where `t_data_place_cater_order`.`shop_id` = `t_dim_business`.`shop_id` and `t_dim_business`.`province` = '上海市' group by `t_data_place_cater_order`.`agent_code` order by ISNULL(`t_data_place_cater_order`.`agent_code`) ASC, `t_data_place_cater_order`.`agent_code` ASC]
2014-03-25 10:06:51,683 DEBUG [mondrian.sql] 15: , exec 178 ms
2014-03-25 10:06:51,683 DEBUG [mondrian.sql] 15: , exec+fetch 179 ms, 3 rows


2025/08/29 16:28:53 - 首次全量插入.0 - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : Unexpected error 2025/08/29 16:28:53 - 首次全量插入.0 - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : org.pentaho.di.core.exception.KettleDatabaseException: 2025/08/29 16:28:53 - 首次全量插入.0 - Couldn't get row from result set 2025/08/29 16:28:53 - 首次全量插入.0 - 当前命令期间出错(完成状态 0)。从数据类型 varchar 转换为 bigint 时出错。 2025/08/29 16:28:53 - 首次全量插入.0 - 2025/08/29 16:28:53 - 首次全量插入.0 - at org.pentaho.di.core.database.Database.getRow(Database.java:2546) 2025/08/29 16:28:53 - 首次全量插入.0 - at org.pentaho.di.core.database.Database.getRow(Database.java:2516) 2025/08/29 16:28:53 - 首次全量插入.0 - at org.pentaho.di.core.database.Database.getRow(Database.java:2494) 2025/08/29 16:28:53 - 首次全量插入.0 - at org.pentaho.di.trans.steps.tableinput.TableInput.doQuery(TableInput.java:259) 2025/08/29 16:28:53 - 首次全量插入.0 - at org.pentaho.di.trans.steps.tableinput.TableInput.processRow(TableInput.java:140) 2025/08/29 16:28:53 - 首次全量插入.0 - at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62) 2025/08/29 16:28:53 - 首次全量插入.0 - at java.lang.Thread.run(Thread.java:745) 2025/08/29 16:28:53 - 首次全量插入.0 - Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: 当前命令期间出错(完成状态 0)。从数据类型 varchar 转换为 bigint 时出错。 2025/08/29 16:28:53 - 首次全量插入.0 - at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:278) 2025/08/29 16:28:53 - 首次全量插入.0 - at com.microsoft.sqlserver.jdbc.SQLServerResultSet$FetchBuffer$FetchBufferTokenHandler.onDone(SQLServerResultSet.java:5470) 2025/08/29 16:28:53 - 首次全量插入.0 - at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:103) 2025/08/29 16:28:53 - 首次全量插入.0 - at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:42) 2025/08/29 16:28:53 - 首次全量插入.0 - at com.microsoft.sqlserver.jdbc.SQLServerResultSet$FetchBuffer.nextRow(SQLServerResultSet.java:5573) 2025/08/29 16:28:53 - 首次全量插入.0 - at com.microsoft.sqlserver.jdbc.SQLServerResultSet.fetchBufferNext(SQLServerResultSet.java:1824) 2025/08/29 16:28:53 - 首次全量插入.0 - at com.microsoft.sqlserver.jdbc.SQLServerResultSet.next(SQLServerResultSet.java:1082) 2025/08/29 16:28:53 - 首次全量插入.0 - at org.pentaho.di.core.database.Database.getRow(Database.java:2534) 2025/08/29 16:28:53 - 首次全量插入.0 - ... 6 more 2025/08/29 16:28:53 - 首次全量插入.0 - Finished reading query, closing connection. 2025/08/29 16:28:53 - 首次全量插入.0 - 完成处理 (I=0, O=0, R=0, W=0, U=0, E=1) 2025/08/29 16:28:53 - 测试1 - 转换被检测 2025/08/29 16:28:53 - 测试1 - 转换正在杀死其他步骤! 2025/08/29 16:28:53 - 测试1 - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : 错误被检测到! 2025/08/29 16:28:53 - Spoon - 转换完成!! 2025/08/29 16:28:53 - 测试1 - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : 错误被检测到! 2025/08/29 16:28:53 - 测试1 - ERROR (version 7.1.0.0-12, build 1 from 2017-05-16 17.18.02 by buildguy) : 错误被检测到!、
最新发布
08-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值