Prerequisites
JRE 1.4+
Tomcat 5.5+ [with JDBC driver in the tomcat\lib directory]
RDMBS + JDBC driver
Versions used
JRE 1.6.0_18
Tomcat 6.0.20
MySQL 5.0.45
MySQL Connector/J 5.1.10
Steps
- Download the mondrian zip package from sourceforge, http://sourceforge.net/projects/mondrian/files/
- Extract the zip file to a temporary folder e.g. C:\temp
- Download the sample foodmart database creation script for mysql from http://sites.google.com/a/dlpage.phi-integration.com/pentaho/mondrian/mysql-foodmart-database
- Extract the gzip package to a temporary location e.g. C:\temp
- Open a command prompt window and type type mysql -h localhost -u root -p
- Enter the root password to access mysql then enter the following commands to create the foodmart database.
mysql> create database foodmart; mysql> grant all on foodmart.* to foodmart@localhost identified by "foodmart"; mysql> use foodmart; mysql> \. c:\temp\foodmart_mysql.sql mysql> quit
- Start tomcat
- Copy c:\temp\mondrian-3.1.5.13307\lib\mondrian.war to the tomcat\webapps directory. This will cause the mondrian application to be deployed.
- Edit the the fourhier.jsp, mondrian.jsp, colors.jsp and arrows.jsp files in the tomcat\webapps\mondrian\web-inf\queries directory. Edit the following line
<jp:mondrianQuery id="query01" jdbcDriver="sun.jdbc.odbc.JdbcOdbcDriver" jdbcUrl="jdbc:odbc:MondrianFoodMart" catalogUri="/WEB-INF/queries/FoodMart.xml">
- Replace it with details of the mysql foodmart database you've just created
<jp:mondrianQuery id="query01" jdbcDriver="com.mysql.jdbc.Driver" jdbcUrl="jdbc:mysql://localhost/foodmart?user=foodmart&password=foodmart" catalogUri="/WEB-INF/queries/FoodMart.xml">
- Edit the the testrole.jsp files in the tomcat\webapps\mondrian\web-inf\queries directory. Edit the following line
<jp:mondrianQuery id="query01" jdbcDriver="sun.jdbc.odbc.JdbcOdbcDriver" jdbcUrl="jdbc:odbc:MondrianFoodMart" catalogUri="/WEB-INF/queries/FoodMart.xml" role="California manager">
- Replace it with details of the mysql foodmart database you've just created
<jp:mondrianQuery id="query01" jdbcDriver="com.mysql.jdbc.Driver" jdbcUrl="jdbc:mysql://localhost/foodmart?user=foodmart&password=foodmart" catalogUri="/WEB-INF/queries/FoodMart.xml" role="California manager">
- Edit the tomcat\webapps\mondrian\web-inf\datasources.xml file. Edit the datasourceinfo tag of the default data source to have the details of the sample foodmart database. e.g.
<DataSourceInfo>Provider=mondrian;Jdbc=jdbc:mysql://localhost/foodmart;JdbcUser=foodmart;JdbcPassword=foodmart;JdbcDrivers=com.mysql.jdbc.Driver;</DataSourceInfo>
- Edit the tomcat\webapps\mondrian\web-inf\mondrian.properties file. Edit the connectionstring property to have the details of the sample foodmart database. e.g.
mondrian.test.connectString=Provider=mondrian;Jdbc=jdbc:mysql://localhost/foodmart;JdbcUser=foodmart;JdbcPassword=foodmart;JdbcDrivers=com.mysql.jdbc.Driver;Catalog=/WEB-INF/queries/FoodMart.xml;
- Edit the tomcat\webapps\mondrian\web-inf\web.xml file. Modify all occurrences of the string @mondrian.webapp.connectString@, replacing it with details for connecting to the sample foodmart database. This will be required for the connectString context parameter and the MDXQueryServlet servlet sections of the file e.g
<context-param> <param-name>connectString</param-name> <param-value>Provider=mondrian;Jdbc=jdbc:mysql://localhost/foodmart;JdbcUser=foodmart;JdbcPassword=foodmart;Catalog=/WEB-INF/queries/FoodMart.xml;JdbcDrivers=com.mysql.jdbc.Driver;</param-value> </context-param> <servlet> <servlet-name>MDXQueryServlet</servlet-name> <servlet-class>mondrian.web.servlet.MdxQueryServlet</servlet-class> <init-param> <param-name>connectString</param-name> <param-value>Provider=mondrian;Jdbc=jdbc:mysql://localhost/foodmart;JdbcUser=foodmart;JdbcPassword=foodmart;JdbcDrivers=com.mysql.jdbc.Driver;Catalog=/WEB-INF/queries/FoodMart.xml;</param-value> </init-param> </servlet>
- Stop tomcat
- Download the binary distribution of xalan 2.7.1 from http://xml.apache.org/xalan-j/downloads.html
- Unzip the package to a temporary folder e.g. c:\temp
- Delete the file tomcat\webapps\mondrian\web-inf\lib\xalan.jar
- Copy the files xalan.jar, xercesImpl.jar, xml-apis.jar and serializer.jar from c:\temp\xalan-j_2_7_1 to the folder tomcat\webapps\mondrian\WEB-INF\lib\
- Start tomcat
- Using your browser, navigate to localhost:8080/mondrian
- You can now get a feel of the examples using the links provided.
Using the schema workbench
In order to create OLAP cubes, you can use the mondrian schema workbench. The schema workbench is a Java desktop application allows you to
- Visually create and test Mondrian OLAP cube schemas, validating the schema against the cube database
- Run example MDX queries using the schema and the database
- Browse the cube database
- Download the schema workbench zip package from sourceforge, http://sourceforge.net/projects/mondrian/files/
- Extract the zip file to c:\
- Place jdbc drivers to connect to the source database in the c:\schema-workbench\drivers folder
- Double-click the file c:\schema-workbench\workbench.bat to start the schema workbench. You'll need to have defined a JAVA_HOME or JRE_HOME environment variable pointing to the java location.
- Click on the Tools | Connection menu
- Enter the connection details for the database
- You can then open the xml file that contains a mondrian schema definition for editing, or create a new schema definition.