[Mondrian] begining with olap4j

Kezern kezern at gmail.com
Fri Jun 19 03:29:33 EDT 2009


Hi all,
I have just started with mondrian and olap4j. I'm trying to build a java 
class which connects to my mondrian and extract some data.
I have deployed the mondrian-embedded.war into my tomcat and I have made 
some test with jpivot.
Now I'm building the new class in eclipse following the instrucions of 
the olap4j functional specifications.
I have written this class.

package olap;

import java.sql.DriverManager;
import java.sql.SQLException;
import org.apache.log4j.Logger;

import org.olap4j.*;

public class App
{
    public static void main( String[] args ) throws 
ClassNotFoundException, SQLException
    {
        System.out.println( "Hello World!" );
        Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
        OlapConnection connection =
            (OlapConnection) DriverManager.getConnection(
            "jdbc:mondrian:local:jdbcURL=jdbc:odbc:MondrianFoodMart;" +
            "Catalog=/WEB-INF/queries/FoodMart.xml;" +
            "Role='California manager'");
        OlapWrapper wrapper = (OlapWrapper) connection;
        OlapConnection olapConnection = (OlapConnection) 
wrapper.unwrap(OlapConnection.class);
        OlapStatement statement = olapConnection.createStatement();

//        OlapResult result =
//            statement.execute(
//                "SELECT {[Measures].[Unit Sales]} ON COLUMNS,\n" +
//                "  {[Product].Members} ON ROWS\n" +
//                "FROM [Sales]");
    }
}

And I get this error when the class tries to make de connection:
Exception in thread "main" mondrian.olap.MondrianException: Mondrian 
Error:Internal error: Connect string 
'local:jdbcURL=jdbc:odbc:MondrianFoodMart; 
Catalog=/WEB-INF/queries/FoodMart.xml; Role=California manager' must 
contain either 'Jdbc' or 'DataSource'
I have been looking for a solution but I couldn't find one.
Thanks every body.







More information about the Mondrian mailing list