如何在Mondrian中使用DRILLTHROUGH
查询?例如,此MDX查询
DRILLTHROUGH
SELECT
measures.MEMBERS ON 0
FROM
events
生成异常:
java.lang.ClassCastException: mondrian.olap.DrillThrough cannot be cast to mondrian.olap.Query
at mondrian.olap4j.MondrianOlap4jStatement$1.execute(MondrianOlap4jStatement.java:362)
at mondrian.olap4j.MondrianOlap4jStatement$1.execute(MondrianOlap4jStatement.java:360)
at mondrian.server.Locus.execute(Locus.java:87)
at mondrian.server.Locus.execute(Locus.java:72)
at mondrian.olap4j.MondrianOlap4jStatement.parseQuery(MondrianOlap4jStatement.java:356)
at mondrian.olap4j.MondrianOlap4jStatement.executeOlapQuery(MondrianOlap4jStatement.java:346)
在代码中,我将MDX字符串传递给语句,如下所示:
OlapConnection connection = DriverManager.getConnection(connection_string).unwrap(OlapConnection.class);
connection.createStatement.executeOlapQuery(mdx);
我还尝试在drillThrough
上调用Cell
,但这导致异常org.postgresql.util.PSQLException: FATAL: sorry, too many clients already
。也许我没有正确管理连接?请参阅我的其他问题:Mondrian OLAP connection management。
答案 0 :(得分:2)
钻取操作将返回ResultSet(实现常规JDBC API),因此您需要使用它:
olapConnection.createStatement().executeQuery(String mdx)