简体   繁体   中英

Retrieving data from MDX request Mondrian

I am trying to get all the data from an MDX request. For example, I want to foreach every row in the result. I have the following code:

String cnxURL =
    "Jdbc=jdbc:" +
    "postgresql://localhost/foodmart;" +
    "JdbcDrivers=org.postgresql.Driver;" +
    "JdbcUser=postgres;" +
    "JdbcPassword=postgres;" +
    "Catalog=file:../queries/FoodMart.xml;";
Connection connection = DriverManager.getConnection(cnxURL, null);

String query = "Select ...";
Query q = connection.parseQuery(query);
Result result = connection.execute(q);

I tried result.getCell(new int[]{0,0}) , but I don't know how many rows and what dimension my result has. I also tried to use PrintWriter like:

File f = new File("output");
try {
    PrintWriter pw = new PrintWriter(f);
    result.print(pw);
}
catch (FileNotFoundException e) {}

but only one query out of ten got printed.

What am i doing wrong here? How can get this working?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM