1.获取需要的jar包
下载mondrian-3.4.1.zip
解压至C:\mondrian
拷贝C:\mondrian\lib下的mondrian.war到tomcat下的webapps下
重启tomcat.自动加载webapps - mondrian.war
拷贝tomcat\webapps\mondrian\WEB-INF\lib下所有jar包到C:\mondrian\lib
【还需要将mysql\Connector J 5.*.*\下的mysql-connector-java-5.*.*-bin.jar拷贝到C:\mondrian\lib】
2.准备数据库
安装好mysql数据库
创建database foodmart
#create database foodmart;
#grant all privileges on *.* to 'foodmart'@'localhost' identified by 'foodmart';
3.使用mondrian自带的工具导数据到数据库中
java -cp C:\mondrian\lib\mondrian.jar;C:\mondrian\lib\log4j-1.2.8.jar;C:\mondrian\lib\commons-logging-1.0.4.jar;C:\mondrian\lib\eigenbase-xom.jar;C:\mondrian\lib\eigenbase-resgen.jar;C:\mondrian\lib\eigenbase-properties.jar;C:\mondrian\lib\mysql-connector-java-5.1.20-bin.jar;C:\mondrian\lib\olap4j.jar mondrian.test.loader.MondrianFoodMartLoader -verbose -tables -data -indexes -jdbcDrivers="com.mysql.jdbc.Driver" -inputFile=C:\mondrian\demo\FoodMartCreateData.sql -outputJdbcURL="jdbc:mysql://localhost/foodmart?user=foodmart&password=foodmart"
其中如果jar包的版本不一样,直接把jar包的版本去掉即可。
运行几分钟,就创建好了。
如:Finished load at: Mon Nov 26 13:46:47 CST 2012就表示导完了。
4.检查
mysql> show databases;
mysql> use foodmart
Database changed
mysql> show tables;
+-------------------------------+
| Tables_in_foodmart |
+-------------------------------+
| account |
| agg_c_10_sales_fact_1997 |
| agg_c_14_sales_fact_1997 |
| agg_c_special_sales_fact_1997 |
| agg_g_ms_pcat_sales_fact_1997 |
| agg_l_03_sales_fact_1997 |
| agg_l_04_sales_fact_1997 |
| agg_l_05_sales_fact_1997 |
| agg_lc_06_sales_fact_1997 |
| agg_lc_100_sales_fact_1997 |
| agg_ll_01_sales_fact_1997 |
| agg_pl_01_sales_fact_1997 |
| category |
| currency |
| customer |
| days |
| department |
| employee |
| employee_closure |
| expense_fact |
| inventory_fact_1997 |
| inventory_fact_1998 |
| position |
| product |
| product_class |
| promotion |
| region |
| reserve_employee |
| salary |
| sales_fact_1997 |
| sales_fact_1998 |
| sales_fact_dec_1998 |
| store |
| store_ragged |
| time_by_day |
| warehouse |
| warehouse_class |
+-------------------------------+
37 rows in set (0.00 sec)
说明一切OK了。
接下来就可以直接使用CUBE文件FoodMart.xml了。