To learn about this powerful open-source OLAP tool, we will first learn from its own demo example program. Below we will provide several configuration methods for connecting to the database (ODBC data source, MySQL, Oracle) on the Windows platform.
1. Introduction to Mondrian (reference to the official introduction ):
Mondrian is an OLAP (Online Analytical Processing) database written in Java. It reads from JDBC data sources, aggregates data in a memory cache, and implements the MDX language and XML/a api.
(Forums and mailing list at http://mondrian.pentaho.org .)
Ii. Download the Mondrian Tool
Open source Website: http://sourceforge.net/project/showfiles.php? Group_id = 35302
Download the latest version (): mondrian-2.4.2.9831.zip also has a derby version, now I do not know what the difference between them, temporarily download the previous one on the line.
3. Configure and run Mondrian
The demo provided by Mondrian is a Web application that is directly stored on the server and can be run after the database connection is configured. Prerequisites: JDK and tomcat are installed on the computer.
First, decompress the downloaded mondrian-2.4.2.9831.zip file. You can see several folders: demow.docw.libw.mondrian-2.4.2.9831-src.zip. The demo folder contains the data sources (ACCESS) and SQL scripts required by the demo program, and a foodmart. XML is a file written in the MDX language. The doc folder is a help document in English and can be referenced. The LIB folder is the jar package of the Mondrian core API class.
The demo program is the Mondrian. War file in the Lib folder, decompress it to the webapp directory under the Tomcat server, and then configure the database to run. The following three methods are provided.
(1) JDBC-ODBC connection
You need to create a data source named mondrianfoodmart. The data source points to the database/demo/access/mondrianfoodmart. MDB. Start the Tomcat server and enter http: // localhost: 8080/Mondrian in the browser to see the effect.
This method is the default of the example program. You do not need to modify some files.
(2) MySQL database
Step 1: Open the Mysql Data Server and create the database footmart;
Step 2: place the MySQL JDBC driver package mysql-connector-java-5.1.5-bin.jar under the Tomcat Lib. Then, create a database in the command line. Run cmd.exe and enter the following command:
Java-CP "C:/program files/Apache Software Foundation/tomcat 5.5/webapps/Mondrian/WEB-INF/lib/Mondrian. jar; C:/program files/Apache Software Foundation/tomcat 5.5/webapps/Mondrian/WEB-INF/lib/log4j-1.2.8.jar; C: /program files/Apache Software Foundation/tomcat 5.5/webapps/Mondrian/WEB-INF/lib/eigenbase-resgen.jar; C: /program files/Apache Software Foundation/tomcat 5.5/webapps/Mondrian/WEB-INF/lib/eigen Base-xom.jar; C:/program files/Apache Software Foundation/tomcat 5.5/webapps/Mondrian/WEB-INF/lib/eigenbase-properties.jar; C: /program files/Apache Software Foundation/tomcat 5.5/common/lib/mysql-connector-java-5.1.5-bin.jar "Mondrian. test. loader. mondrianfoodmartloader-verbose-tables-data-indexes-jdbcdrivers = com. mySQL. JDBC. driver-inputfile = foodmartcreatedata. SQL-outputjdbcurl = "JDBC: mysql: // Lo Calhost: 3306/foodmart? User = root & Password = admin"
This step is important. The above red mark is the jar to be used. The blue mark is modified based on your computer's situation. Pay attention to the spaces in it, it is best to write it in a text file and copy it to the command line to run it. If it runs successfully, it may take 10 minutes to create a database table, index, and insert test data.
Step 3: modify the configuration file and change the driver connection string.
Modify Mondrian. properties, datasources. XML, and Web. xml files respectively.
Find the following code:
Provider = Mondrian; JDBC = JDBC: ODBC: mondrianfoodmart; Catalog =/WEB-INF/queries/foodmart. xml; jdbcdrivers = sun. JDBC. ODBC. jdbcodbcdriver;
Replace:
Provider = Mondrian; JDBC = JDBC: mysql: // localhost: 3306/foodmart? User = root & #38; Password = admin; Catalog =/WEB-INF/queries/foodmart. xml; jdbcdrivers = com. MySQL. JDBC. Driver
The blue area above is modified as needed.
Step 4: modify several JSP pages and change the driver connection string.
Modify fourheir. jsp, Mondrian. jsp, colors. jsp and arrows. jsp in the tomcat_home/webapps/Mondrian/WEB-INF/queries folder, and find the following code:
<JP: mondrianquery id = "query01" jdbcdriver = "Sun. JDBC. ODBC. jdbcodbcdriver "Maid =" JDBC: ODBC: mondrianfoodmart "cataloguri ="/WEB-INF/queries/foodmart. XML ">
Replace:
<JP: mondrianquery id = "query01" jdbcdriver = "com. MySQL. JDBC. Driver" jdbcurl = "JDBC: mysql: // localhost: 3306/foodmart? User = root & Password = admin "cataloguri ="/WEB-INF/queries/foodmart. xml ">
Step 5: After the configuration is complete, open the Tomcat server and enter http: // localhost: 8080/Mondrian in the browser, the following will appear:
Mondrian examples:
Jforwardedtable
Jforwardedtable by xmla
July with 4 hierarchies
JWS with arrows
July with colors
Various queries formatted using the Mondrian tag-Library
Basic interface for ad hoc queries
XML for analysis Tester
Just click it and check it out. If no error is prompted, it will succeed ^
(3) Oracle Database
The configuration steps for Oracle and MySQL are similar, just change the driver connection string accordingly. Here is a reference for my configuration.
Step 1: ensure that the Oracle Data Server is enabled.
Step 2: place the oracle JDBC driver package ojdbc14.jar (which can be found in the JDBC directory under the Oracle directory if it is Oracle10g) under the Tomcat Lib. Then, create a database in the command line. Run cmd.exe and enter the following command:
Java-CP "D:/program files/Apache Software Foundation/tomcat 5.5/webapps/Mondrian/WEB-INF/lib/Mondrian. jar; D:/program files/Apache Software Foundation/tomcat 5.5/webapps/Mondrian/WEB-INF/lib/log4j-1.2.8.jar; D: /program files/Apache Software Foundation/tomcat 5.5/webapps/Mondrian/WEB-INF/lib/eigenbase-resgen.jar; D: /program files/Apache Software Foundation/tomcat 5.5/webapps/Mondrian/WEB-INF/lib/eigenbase-xom.jar; D: /program files/Apache Software Foundation/tomcat 5.5/webapps/Mondrian/WEB-INF/lib/ojdbc14.jar; D: /program files/Apache Software Foundation/tomcat 5.5/webapps/Mondrian/WEB-INF/lib/eigenbase-properties.jar"
Mondrian. Test. loader. mondrianfoodmartloader
-Verbose-tables-data-jdbcdrivers = "oracle. JDBC. Driver. oracledriver"
-Inputfile = foodmartcreatedata. SQL
-Outputjdbcurl = "JDBC: oracle: thin: System/admin @ oracle_host: 1521: orcl"
This step is very important. After the database is created successfully, the data cannot be tested.
Step 3: modify the configuration file and change the driver connection string.
Modify Mondrian. properties, datasources. XML, and Web. xml files respectively.
Find the following code:
Provider = Mondrian; JDBC = JDBC: ODBC: mondrianfoodmart; Catalog =/WEB-INF/queries/foodmart. xml; jdbcdrivers = sun. JDBC. ODBC. jdbcodbcdriver;
Replace:
Provider = Mondrian; JDBC = JDBC: oracle: thin: System/admin @ localhost: 1521: orcl; jdbcdrivers = oracle. JDBC. driver. oracledriver; Catalog =/WEB-INF/queries/foodmart. XML
The blue area above is modified as needed.
Step 4: modify several JSP pages and change the driver connection string.
Modify fourheir. jsp, Mondrian. jsp, colors. jsp and arrows. jsp in the tomcat_home/webapps/Mondrian/WEB-INF/queries folder, and find the following code:
<JP: mondrianquery id = "query01" jdbcdriver = "Sun. JDBC. ODBC. jdbcodbcdriver "Maid =" JDBC: ODBC: mondrianfoodmart "cataloguri ="/WEB-INF/queries/foodmart. XML ">
Replace:
<JP: mondrianquery id = "query01" jdbcdriver = "oracle. JDBC. driver. oracledriver "jdbcurl =" JDBC: oracle: thin: System/admin @ localhost: 1521: orcl "cataloguri ="/WEB-INF/queries/foodmart. XML ">
Step 5: The configuration is complete. Run the command to see if it is successful.
Note: To use the Mondrian tool for development, you must learn the API functions contained in it, learn the MDX language, and write your own XML files to display our data in multiple dimensions. See the Help file in the doc.