Welcome!

Thursday, July 8, 2010

How to Install & Config Mondrian OLAP Server? (1)

Mondrian is an OLAP server written in Java. It enables you to interactively analyze very large datasets stored in SQL databases without writing SQL.

SpagoBI uses SpagoBIXMLAEngine to access XMLA compliant server like Mondiran OLAP server.

This article records the detail of installing and configuring Mondrian OLAP server on the following environment. The solution below solved the reported issues that mondrian don't work well with JDK 1.6. You can find these issues at here or there.

Environment
============
SpagoBI: version 2.5
OS Server: Windows server 2008 R2 (x64)
App Server: Tomcat 6.0.26
Database: MySQL 5.1.48
Java: JDK 1.6 or JDK 1.5
Mondrian: 3.2.0.13661
Axis: 1.4


Prepare Works
  • Download Tomcat server 6.0.26 from here, and unzip to local folder tomcat_home/;
  • Download MySQL server 5 and jdbc driver (mysql-connector-java-5.1.12-bin.jar) from here, and setup by following MySQL documentation;
  • Download Mondrian 3.2.0.13661 from here, and unzip to local folder mondrian-3.2.0.13661/;
  • Download Apache Axis 1.4 from here, and unzip to local folder axis-1_4/.

Setup the Test Data in MySQL
Please follow the official Mondrian installation guide to install the test database "foodmart" into MySQL database.

Deploy Mondrian Web Application to Tomcat
  • Explode the war file (mondrian-3.2.0.13661/lib/mondrian.war) to the folder at
    • tomcat_home/webapps/mondrian;
  • Delete the following jar files:
    • saaj-api.jar
    • saaj-ri.jar
    • xalan.jar
    from the folder:
    • tomcat_home/webapps/mondrian/WEB-INF/lib
  • Copy from the folder axis-1_4/lib these jar files:
    • axis.jar
    • commons-discovery-0.2.jar
    • saaj.jar
    • jaxrpc.jar
    • wsdl4j-1.5.1.jar
    to the folder:
    • tomcat_home/webapps/mondrian/WEB-INF/lib

  • Also copy MySQL jdbc driver jar file to the folder ;
    • tomcat_home/webapps/mondrian/WEB-INF/lib
  • Modify the file mondrian.properties from the folder
    • tomcat_home/webapps/mondrian/WEB-INF
  • Modify the file datasources.xml from the folder
    • tomcat_home/webapps/mondrian/WEB-INF
  • Modify the file web.xml from the above same folder;
  • Modify the fourhier.jsp, mondrian.jsp, colors.jsp, testrole.jar, and arrows.jsp files as specified in mondrian installation guide from the folder:
    • tomcat_home/webapps/mondrian/WEB-INF/queries

Start MySQL Database

Start Tomcat server

Hit http://localhost:8080/mondrian.


How to Install & Config Mondrian OLAP Server? (2)

In the first part of the article, I introduced the steps to setup & config the Mondrian OLAP server deploying on Tomcat (application) server, to run against the test database on MySQL (database) server.

By clicking the URL http://localhost:8080/mondrian, you will see the following Mondrian examples page:

By clicking each of the examples, manipulating the OLAP control panel provided by JPivot interface, you can navigate through the OLAP dimensions, drill through, and control the display layout.

JPivot pivot table

This example uses JPivot's interface (JSP tag - mondrianQuery) to send query to Mondrian's API (Mondrian query executor) to access Sales cube (whose schema information is defined in FoodMart.xml file).

select
{[Measures].[Unit Sales],
[Measures].[Store Cost],
[Measures].[Store Sales]} on columns,
{([Promotion Media].[All Media],
[Product].[All Products])} ON rows
from
Sales


JPivot pivot table by XMLA

This example uses JPivot's interface (JSP tag - xmlaQuery) to access Sales cube via XML for Analysis interface (Mondrian as XMLA provider).

This example use the same MDX query as above.


JPivot with 4 hierarchies

This example uses JPivot's interface (JSP tag - mondrianQuery) to send query to Mondrian's API (Mondrian query executor) to access Sales cube, but by 4 dimensions (Gender, Martial Status, Customers, Product), the MDX query as:

select
{[Measures].[Unit Sales],
[Measures].[Store Cost],
[Measures].[Store Sales]} on columns,
{([Gender].[All Gender],
[Marital Status].[All Marital Status],
[Customers].[All Customers],
[Product].[All Products] ) } on rows
from
Sales
where
([Time].[1997])


JPivot with role 'California Manager' set

This example also uses JPivot's interface (JSP tag - mondrianQuery) to send query to Mondrian's API (Mondrian query executor) to access Sales cube with role limitation setting to "California manager". So, it only show the data that's available to "California manager".

select
{[Measures].[Unit Sales],
[Measures].[Store Cost],
[Measures].[Store Sales]} on columns,
{([Marital Status].[All Marital Status],
[Customers],
[Product].[All Products])} on rows
from
Sales
where
([Time].[1997])


JPivot with arrows

This example also uses JPivot's interface (JSP tag - mondrianQuery) to send query to Mondrian's API (Mondrian query executor) to access Sales cube with the following MDX query:

with member
[Measures].[ROI] as
'(([Measures].[Store Sales]-[Measures].[Store Cost])/ [Measures].[Store Cost])',
format_string =
IIf((((([Measures].[Store Sales]-[Measures].[Store Cost])
/[Measures].[Store Cost]) * 100.0) > 150.0),
"|#.00%|arrow='up'",
IIf((((([Measures].[Store Sales]-[Measures].[Store Cost])
/[Measures].[Store Cost]) * 100.0) <>
"|#.00%|arrow='down'",
"|#.00%|arrow='none'"))
select
{[Measures].[ROI],
[Measures].[Store Cost],
[Measures].[Store Sales]} ON columns,
{[Product].[All Products]} ON rows
from
[Sales]
where
[Time].[1997]

This example introduce the conditional style to ROI measure display with image.


JPivot with colors

This example also uses JPivot's interface (JSP tag - mondrianQuery) to send query to Mondrian's API (Mondrian query executor) to access Sales cube with the following MDX query:

with member
[Measures].[ROI] as
'(([Measures].[Store Sales]-[Measures].[Store Cost])/
[Measures].[Store Cost])',
format_string =
IIf((((([Measures].[Store Sales]-[Measures].[Store Cost])/
[Measures].[Store Cost]) * 100.0) > 150.0),
"|#.00%|style='green'",
IIf((((([Measures].[Store Sales]-[Measures].[Store Cost])/
[Measures].[Store Cost]) * 100.0) <>
"|#.00%|style='red'", "#.00%"))
select
{[Measures].[ROI],
[Measures].[Store Cost],
[Measures].[Store Sales]} ON columns,
{[Product].[All Products]} ON rows
from
[Sales]
where
[Time].[1997]

This example introduce the conditional style to ROI measure display with color.


Various queries formatted using the Mondrian tag-library

This example shows the use of Mondrian MDX tag-library to transform & format the data layout.


Basic interface for ad hoc queries

This example provides a way to execute the ad-hoc MDX query against Mondrian OLAP server. MDXQueryServlet receives MDX queries, executes them, and formats the results in an HTML table.



XML for Analysis tester

This example provides another way to execute ad-hoc MDX query against Mondrian OLAP server via XML for Analysis interface. DefaultXmlaServlet receives MDX queries, executes them, and formats the results in an HTML table.