1

如何在DRILLTHROUGHMondrian 中使用查询?例如,这个 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);

我也尝试过调用drillThrougha Cell,但这会导致异常org.postgresql.util.PSQLException: FATAL: sorry, too many clients already。也许我没有正确管理连接?请参阅我的另一个问题:蒙德里安 OLAP 连接管理

4

1 回答 1

2

钻取操作将返回一个 ResultSet(实现常规 JDBC API),因此您需要改用它:

olapConnection.createStatement().executeQuery(String mdx)
于 2013-05-28T13:28:10.813 回答