[Mondrian] begining with olap4j

Julian Hyde jhyde at pentaho.com
Tue Jun 23 14:04:58 EDT 2009


JDBC can't find a driver to connect to postgres. You need to put the
postgres driver jar on your classpath and add the driver to JdbcDrivers
connect string property.
 
You probably can omit the second step if you're running JDK 1.6 or higher.
JDBC drivers are automatically loaded if they are in jars on the classpath.
(Assuming that the postgres folks built their jar correctly.)
 
http://lmgtfy.com/?q=mondrian+%22no+suitable+driver%22
 
Julian


  _____  

From: Kezern [mailto:kezern at gmail.com] 
Sent: Monday, June 22, 2009 9:24 AM
To: jhyde at pentaho.com
Cc: Mondrian developer mailing list
Subject: Re: [Mondrian] begining with olap4j


Julian, you was rigth. After rebooting the error changed and I had to add
commons-vfs.jar to the path.
now I have an error of no suitable driver.
Exception in thread "main" org.apache.commons.dbcp.DbcpException:
java.sql.SQLException: No suitable driver
I have searched in google and in the forum but I didn't find any answer.


2009/6/22 Julian Hyde <jhyde at pentaho.com>


When faced with an error stack, you should look for the error message and
google it. This is the error:
 
NoClassDefFoundError: org/apache/commons/pool/ObjectPool
 
And google tells you that  you need to put commons-pool.jar on your path.
 
Julian



  _____  

From: Kezern [mailto:kezern at gmail.com] 
Sent: Monday, June 22, 2009 8:43 AM
To: jhyde at pentaho.com
Cc: Mondrian developer mailing list
Subject: Re: [Mondrian] begining with olap4j


Hi Julian,
Thanks for your answer. I have made some changes following your
instructions.
I have a postgresql database and a cuble defined into mondrian in a xml
file.
Now my code is as follows:
        Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
        OlapConnection connection =
            (OlapConnection) DriverManager.getConnection(
 
"jdbc:mondrian:Jdbc=jdbc:postgresql://localhost:5432/CdM_db;JdbcUser=postgre
s;JdbcPassword=Tbcrkpi47a8;" +
 
"Catalog=/descargas/apache-tomcat-5.5.27/webapps/mondrian-embedded/WEB-INF/q
ueries/tickets4.mondrian.xml;" +
            "Role='California manager'");
        OlapWrapper wrapper = (OlapWrapper) connection;
        OlapConnection olapConnection = (OlapConnection)
wrapper.unwrap(OlapConnection.class);
        OlapStatement statement = olapConnection.createStatement();

And I get this error:
Exception in thread "main" mondrian.olap.MondrianException: Mondrian
Error:Internal error: Error while creating connection pool (with URI
jdbc:postgresql://localhost:5432/CdM_db)
    at
mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:785)
    at mondrian.olap.Util.newInternal(Util.java:1435)
    at
mondrian.rolap.RolapConnection.createDataSource(RolapConnection.java:396)
    at mondrian.rolap.RolapConnection.<init>(RolapConnection.java:173)
    at mondrian.rolap.RolapConnection.<init>(RolapConnection.java:117)
    at mondrian.olap.DriverManager.getConnection(DriverManager.java:110)
    at mondrian.olap.DriverManager.getConnection(DriverManager.java:74)
    at
mondrian.olap4j.MondrianOlap4jConnection.<init>(MondrianOlap4jConnection.jav
a:111)
    at
mondrian.olap4j.FactoryJdbc3Impl$MondrianOlap4jConnectionJdbc3.<init>(Factor
yJdbc3Impl.java:110)
    at
mondrian.olap4j.FactoryJdbc3Impl.newConnection(FactoryJdbc3Impl.java:30)
    at
mondrian.olap4j.MondrianOlap4jDriver.connect(MondrianOlap4jDriver.java:109)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at olap.App.main(App.java:22)
Caused by: java.lang.NoClassDefFoundError:
org/apache/commons/pool/ObjectPool
    at
mondrian.rolap.RolapConnection.createDataSource(RolapConnection.java:392)
    ... 11 more

What I'm doing wrong?


2009/6/19 Julian Hyde <jhyde at pentaho.com>


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
>
>
>





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20090623/e42fa865/attachment.html 


More information about the Mondrian mailing list