[Mondrian] begining with olap4j

Julian Hyde jhyde at pentaho.com
Fri Jun 19 12:30:08 EDT 2009


Your connect string is wrong. Something like 

jdbc:mondrian:Datasource=jdbc/SampleData;Catalog=./foodmart/FoodMart.xml;

or

jdbc:mondrian:Jdbc=jdbc:mysql://localhost/foodmart;JdbcUser=foodmart;JdbcPas
sword=foodmart;Catalog=./foodmart/FoodMart.xml;

Always starts 'jdbc:mondrian:' if you're using the mondrian olap4j driver,
or 'jdbc:xmla:' if you're using the XMLA driver.

Then you need 'Datasource=' or, more commonly, 'Jdbc=' to give it the URL of
the underlying database.

Other options for the mondrian driver are documented here:

http://mondrian.pentaho.org/documentation/configuration.php#Connect_string_p
roperties


Julian

 

> -----Original Message-----
> From: mondrian-bounces at pentaho.org 
> [mailto:mondrian-bounces at pentaho.org] On Behalf Of Kezern
> Sent: Friday, June 19, 2009 12:30 AM
> To: mondrian at pentaho.org
> Subject: [Mondrian] begining with olap4j
> 
> 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.
> 
> 
> 
> 
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
> 
> 
> 





More information about the Mondrian mailing list