Results 1 to 1 of 1

Thread: Hi all... :)

  1. #1
    Join Date
    Feb 2009
    Posts
    1
    Rep Power
    0

    Default Storing Resultset of MDX Query..

    Hi,

    A newbie question..

    I have written a code to run MDX queries and display the result of it..
    I find problems in storing the resultset and iterate through it.. i believe it is possible..

    Here is my sample code:


    import mondrian.olap.*;

    import java.io.*;
    import java.util.List;
    import java.util.Map;
    //import java.sql.*;
    //import java.util.*;
    //import mondrian.spi.*;
    //import mondrian.spi.impl.*;
    import mondrian.rolap.*;

    public class Cube
    {

    public static void main(String args[])
    {
    Cube object= new Cube();
    object.method();

    }


    public void method()
    {

    Connection connection = DriverManager.getConnection("Provider=mondrian;" + "Jdbc=jdbc:odbc:MondrianFoodMart;" +
    "Catalog=E:/Pentaho/mondrian-3.0.4.11371/demo/FoodMart.xml;",null);
    Query query = connection.parseQuery(
    "SELECT {[Measures].[Unit Sales], [Measures].[Store Sales]} on columns," +
    " {[Product].children} on rows " +
    "FROM [Sales] " +
    "WHERE ([Time].[1997].[Q1])");
    Result result = connection.execute(query);
    //RolapResult rst=(RolapResult)result;
    result.print(new PrintWriter(System.out,true));



    The output looks like:

    Axis #0:
    {[Time].[1997].[Q1]}
    Axis #1:
    {[Measures].[Unit Sales]}
    {[Measures].[Store Sales]}
    Axis #2:
    {[Product].[All Products].[Drink]}
    {[Product].[All Products].[Food]}
    {[Product].[All Products].[Non-Consumable]}
    Row #0: 5,976
    Row #0: 11,585.80
    Row #1: 47,809
    Row #1: 101,261.32
    Row #2: 12,506
    Row #2: 26,781.23

    I find difficulties in storing the resultset...

    Any ideas???

    Thanks,
    Meena
    Last edited by Meenakshi.Subramanian@lnt; 02-18-2009 at 09:44 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •