Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Querying a dataCube with JAVA

  1. #1

    Default Querying a dataCube with JAVA

    Hey folks,

    I try to execute some MDX-queries on my underlying Postgres-Database. But I am not able to build a connection to this database because of the following error:
    Code:
    SCHWERWIEGEND: Allocate exception for servlet TestLoader
    java.lang.NoSuchMethodError: java.util.EnumSet.of(Lnet/sourceforge/retroweaver/runtime/java/lang/Enum;[Lnet/sourceforge/retroweaver/runtime/java/lang/Enum;)Ljava/util/EnumSet;
        at org.olap4j.impl.Olap4jUtilCompatibleJdk15.enumSetOf(Olap4jUtilCompatibleJdk15.java:34)
        at org.olap4j.impl.Olap4jUtil.enumSetOf(Olap4jUtil.java:451)
        at mondrian.rolap.RolapSchema.<clinit>(RolapSchema.java:63)
        at mondrian.rolap.RolapSchema$Pool.get(RolapSchema.java:1121)
        at mondrian.rolap.RolapSchema$Pool.get(RolapSchema.java:913)
        at mondrian.rolap.RolapConnection.<init>(RolapConnection.java:151)
        at mondrian.rolap.RolapConnection.<init>(RolapConnection.java:87)
        at mondrian.olap.DriverManager.getConnection(DriverManager.java:112)
        at mondrian.olap.DriverManager.getConnection(DriverManager.java:71)
        at mondrian.olap4j.MondrianOlap4jConnection.<init>(MondrianOlap4jConnection.java:135)
        at mondrian.olap4j.FactoryJdbc4Impl$MondrianOlap4jConnectionJdbc4.<init>(FactoryJdbc4Impl.java:369)
        at mondrian.olap4j.FactoryJdbc4Impl.newConnection(FactoryJdbc4Impl.java:34)
        at mondrian.olap4j.MondrianOlap4jDriver.connect(MondrianOlap4jDriver.java:119)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at com.drivenow.data.TestLoader.Init(TestLoader.java:84)
        at com.drivenow.data.TestLoader.<init>(TestLoader.java:55)
        ...
    The approrpiate lines are the following (compare to http://olap4j-demo.googlecode.com/sv...erspective.pdf)
    Code:
    public void Init() throws Exception {
            // load the driver
            Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
           
            // connect to the database
            // here is where we get the error
            this.olapConnection = DriverManager.getConnection(
                    "jdbc:mondrian:" +
                    "JdbcDrivers=org.postgresql.Driver;" +
                    "Jdbc=jdbc:postgresql://<host>?user=<user>&password=<password>;" + 
                    "Catalog=" + this.catalog + ";").unwrap(OlapConnection.class);
            
            if (DEBUG) System.out.println("Connection to database successfully established");
        }
    I already added a buch of libraries to the classPath (including olap4j-jdk and mondrian-jdk) but It has no effect to me. Can anyone give me a hint on how to set up the connection properly?
    Thanks in advance

  2. #2
    Join Date
    Oct 2012
    Posts
    2

    Default

    I had some issues when trying to do a connection like that. Now it's working fine. Take a look at my connection string:

    Code:
     
    String connectString = "jdbc:mondrian:"                                                           
    	            + "Jdbc=jdbc:postgresql://localhost/foodmart?user=foodmart&password=lalalala;"                                
    	            + "Catalog=file:/usr/share/tomcat7/apache-tomcat-7.0.32/webapps/mondrian/WEB-INF/queries/FoodMart.xml;";
    Hope that helps.

  3. #3

    Default

    Just to make sure it isn't something silly; you did replace the <host>, <user> and <password> strings by the actual hostname, username and password when running the code right :-)?

  4. #4
    Join Date
    Mar 2007
    Posts
    142

    Default

    You've probably put a library in there that you shouldn't have. Remove all retroweaver libraries and all builds of Mondrian marked for JDK 1.4 (it should be called something like mondrian-jdk14.jar or something similar) and keep only the JDK5+ jar.
    Luc Boudreau
    aka. Luc le Magnifique
    aka. Monsieur Oui Oui

    Lead Engineer, Pentaho Corporation
    Web: http://devdonkey.blogspot.com
    Twitter: luclemagnifique
    IRC: Monsieur_Oui_Oui@freenode

  5. #5

    Default

    Just to make sure it isn't something silly; you did replace the <host>, <user> and <password> strings by the actual hostname, username and password when running the code right :-)?
    Yeap

    Remove all retroweaver libraries and all builds of Mondrian marked for JDK 1.4 (it should be called something like mondrian-jdk14.jar or something similar) and keep only the JDK5+ jar.
    I just copied the libraries (mondrian-jdk14, olap4j-jdk14 and retroweaver-rt) that come with mondrian-3.3.0.14703 into my buildpath... nothing else

  6. #6

    Default

    OK... I deleted all the libraries and copied the necessaray ones one after the other. Now I have mondrian-jdk14, olap4j-jdk14 and log4j in my buildpath but the error stays the same. Interestingly retroweaver is mentioned inside the errormessage allthough this libraray isn´t inside the buildpath any more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.