Frage

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?

War es hilfreich?

Andere Tipps

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top