postgresqlmondrianxmlarolap

How to use a PostgreSQL DB as XMLA datasource?


Basis:

As i understand it so far, i have to use a OLAP-server that functions as connector between MDX querys and a SQL database to provide XMLA as datasource. Therefor i want to use the Mondrian OLAP-server.

Question:

Now i need to start the Mondrian OLAP-server, connect it to the PostgreSQL database and provide a OLAP-schema.

  1. How to start the Mondrian OLAP-server?
  2. How to connect it to a PostgreSQL database?
  3. How to provide a schema to the mondrian server?
  4. And finaly, how to connect to the mondrian server?

I can't find any step by step guide or any usefull documentation of mondrian. It's all a big cloud to me.


Solution

  • The Problem

    After many, many hours i found this thread: Github - Mondrian issue 202

    The Mondrian developer, in this thread, clearly state that nearly the whole documentation is outdated and doesn't have much todo with the actual Mondrian 4 OLAP server.

    They say that Mondrian 4 is no longer shiped with a deployable WAR file and the schema has big changes.


    Start Mondrian OLAP Server

    To get Mondrian running i downloaded this maven project that starts a mondrian server: mondrian-xmla-spike

    I got everything running with the discribed derby Foodmart database.

    You can either import the project as maven project in an IDE of your choice (what i did) or run mvn via. console.


    Use Mondrian as XMLA provider

    In the maven project you have to check all files (not many) for hardcoded paths and change them to your environment.

    If you have done this, and startet the project as application, the Mondrian Server should be accessible via. a jetty server on the address http://localhost:8888/xmla

    You can connect any component that can use a XMLA datasource and does support Mondrian OLAP server! The last part is very important. Mondrian doesn't comply with the MDX standard completely. Bad decision on the side of Penthao! Most OLAP-components or BI-tools only support MS SQL Server as XMLA datasource.


    Connect Mondrian to PostgreSQL DB

    To connect the existing maven project to a PostgreSQL DB i had to do some steps:

    1. Update the Mondrian Version in the pom (xmla-spike.xml) file to a 4.x Version (i used 4.3.1.5-191). You can choose one from here: Penthao Mondrian Versions
    2. Download the correct JDBC driver (for me it was JDBC42): PostgreSQL JDBC Driver and add the JDBC driver (.jar) to your project libraries

      Or add the correct JDBC driver (i used 9.4.1209) from here: PostgreSQL JDBC Driver JDBC 4.1 to your maven pom (xmla-spike.xml).

    3. Change the <DataSourceInfo> in the datasource.xml to:

      Provider=mondrian;Jdbc=jdbc:postgresql://localhost:5432/default?user=postgre;JdbcDrivers=org.postgresql.Driver;Catalog=/WEB-INF/Schema.xml;

      • DB url: jdbc:postgresql://localhost:5432/default?user=postgre
      • => jdbc:postgresql://host:port/database
    4. Create the Schema.xml file and write a simple schema as descriped here: How to Design a Mondrian 4 Schema

      You can look at the Foodmart example Schema with metamodel 4 here: Foodmart.xml metamodelVersion="4.0"

    5. The <Catalog name="*"> must mach the schema name of the Schema.xml


    This does work for me. I hope i can help someone else with this. If i forgot some steps, pls comment and i will add the missing steps.