日期:2014-05-16  浏览次数:20549 次

导入Mondrian例子数据库到mysql中 windows环境
1.获取需要的jar包
下载mondrian-3.3.0.14703.zip
加压至C:\mondrian
拷贝C:\mondrian\lib下的mondrian.war到tomcate下的webapps下
重启tomcat.自动加载webapps - mondrian.war
拷贝D:\apache-tomcat-6.0.32\webapps\mondrian\WEB-INF\lib下所有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.jar;C:\mondrian\lib\commons-logging.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.0.8-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: Fri May 25 00:07:53 CST 2012就表示导完了。

4.检查
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| foodmart           |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.00 sec)

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