(本文档仅供参考)
问题说明
报表导出报错如下:
Caused by: java.sql.SQLException: java.sql.SQLException: Illegal mix of collations for operation ' IN ' at mondrian.spi.StatementInvocationHandler.invoke(StatementInvocationHandler.java:70) at com.sun.proxy.$Proxy78.executeQuery() at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) at mondrian.rolap.SqlStatement.execute(SqlStatement.java:240) ... 11 more Caused by: java.sql.SQLException: Illegal mix of collations for operation ' IN ' at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2439) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1365) at sun.reflect.GeneratedMethodAccessor62.invoke() at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at mondrian.spi.StatementInvocationHandler$1.call(StatementInvocationHandler.java:50) at mondrian.spi.StatementInvocationHandler$1.call(StatementInvocationHandler.java:47) ... 4 more
解决方案
此问题通常是编码不正确导致的,数据源连接字符串的characterEncoding参数配置的编码与实际库的不一致,改成一致的即可,如下: