Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: olap4j Xmla FoodMart

  1. #1
    Join Date
    Apr 2008
    Posts
    18

    Default olap4j Xmla FoodMart

    Hello,

    works xmla in olap4j just with the FoodMart database?
    Is it possible to use other databases?

    Best regards
    cakbulut

  2. #2
    Join Date
    Feb 2008
    Posts
    6

    Default

    Hi,

    I'm facing some problem in connecting to mondrian (3.0.3.11016) through XML/A.

    Here is what I'm doing to connect:

    =======================================
    Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");

    Connection connection = DriverManager.getConnection("jdbc:xmla:Server='http://127.0.0.1:8080/mondrian/xmla';Provider=Mondrian;"
    +"DataSource='C:/Tomcat6.0.14/webapps/mondrian/WEB-INF/datasources.xml';Catalog='file:///C:/Tomcat6.0.14/webapps/mondrian/WEB-INF/queries/FoodMart.xml';");

    OlapConnection olapConnection = connection.unwrap(OlapConnection.class);

    =======================================

    When I try to run the java application, I get the following error:

    xception in thread "main" java.lang.RuntimeException: org.olap4j.OlapException: No datasource could be found.
    at org.olap4j.driver.xmla.DeferredNamedListImpl.getList(DeferredNamedListImpl.java:76)
    at org.olap4j.driver.xmla.DeferredNamedListImpl.get(DeferredNamedListImpl.java:94)
    at org.olap4j.driver.xmla.DeferredNamedListImpl.get(DeferredNamedListImpl.java:43)
    at org.olap4j.driver.xmla.XmlaOlap4jConnection.<init>(XmlaOlap4jConnection.java:172)


    I've actually configured the datasources.xml in the WEB-INF directory.

    Could you tell me if I'm missing something?

    Thanks,
    Madhav

  3. #3
    Join Date
    Oct 2007
    Posts
    255

    Default asdf

    If you're remotely connecting to the XMLA server then the parameters work a little different than I think you expect.

    For example:

    Code:
    Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
    Connection test = DriverManager.getConnection("jdbc:xmla:Server=http://127.0.0.1:8080/mondrian/xmla;Provider=Mondrian;DataSource=mysource;Catalog=mycatalog;");
    OlapConnection connection = ((OlapWrapper)test).unwrap(OlapConnection.class);
    
    OlapWrapper wrapper = (OlapWrapper) connection;
    OlapConnection olapConnection = wrapper.unwrap(OlapConnection.class);
    OlapStatement statement = connection.createStatement();
    
    CellSet result = statement.executeOlapQuery ("select {[measures]} on columns, non empty {[Date].[All years]} on rows from [foodmart]");
    ...
    Now, a couple of things you'll likely get confused over there:

    :- Provider
    :- DataSource
    :- Catalog

    The server is running its own datasources.xml file in .../tomcat/webapps/mondrian/WEB-INF/datasources.xml. For example:

    Code:
    DataSources>
      <DataSource>
        <DataSourceName>mysource</DataSourceName>
        <DataSourceDescription>This is my datasource</DataSourceName>
        <URL>http://tomcat_hostname:8080/mondrian/xmla</URL>
        <DataSourceInfo>Provider=mondrian;
                        Jdbc=jdbc:mysql://dwh_oltp_server_hostname/foodmart?user=foodmart&password=foodmart;
                        JdbcDrivers=com.mysql.jdbc.Drivers;
                        Catalog=file:///mystuff/foodmart.xml;
        </DataSourceInfo>
        <ProviderName>Mondrian</ProviderName>
        <ProviderType>MDP</ProviderType>
        <AuthenticationMode>Unathenticated</AuthenticationMode>
        <Catalogs>
          <Catalog name="foodmart">
            <Definition>file:///mystuff/foodmart.xml</Definition>
          </Catalog>
        </Catalogs>
      </DataSource>
    </DataSources>
    In the connect string I provided in the java code earlier, DataSource refers to what is between <DataSourceName></DataSourceName> in the datasources.xml file. Similarly, Provider refers to whatever is between <ProviderName></ProviderName>, and catalog refers to the name attribute of the <Catalog> you're interested in from the <Catalogs> section.

    One thing I'm not clear on, the example datasousources.xml files I've seen around all have a catalog file listed twice, once in the <DataSourceInfo> section, the other in the <Catalog>'s <Definition>. If someone has an answer to that question, please post it.

    -Brian
    Last edited by Phantal; 06-09-2008 at 01:09 PM.

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.