欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

导入Mondrian例子数据库到mysql中 windows环境 MondrianMondrianFoodMartLoader

程序员文章站 2024-03-13 23:57:22
...
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           |
| 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)

mysql>

说明一切OK了。

接下来就可以直接使用CUBE文件FoodMart.xml了。