"Go" mondrian+jpivot Source import Eclipse and configure the data source

Source: Internet
Author: User

The steps to import Mondrian source are as follows:

1) Download mondrian-3.0.0.10550 and JPivot 1.8.0, mondrian-3.0.0 later version and JPivot source integration is not together.   JPivot hasn't been updated for a long time!!!! : http://mondrian.pentaho.com/

2) Create a new Web project in Eclipse and name Mondrian.

3) Unzip the mondrian-3.0.0.10550/mondrian-3.0.0.10550-src.zip and overwrite the extracted content with your project

4) Prepare,parser,generate.resources,def Four target procedures for running the Build.xml file in Ant view (Mondrianguidef class is generated by builder!!). If ********* cannot find subfloor.xml**** errors in the builder process, you need to http://code.google.com/p/subfloor/wiki/ Subflloorhowto Download a subfloor.xml file into the Bulid.xml sibling directory)

5) Copy all the jar packages from the Web-inf/lib in the Mondrian-3.0.0.10550/lib/mondrian.war release package to the Lib directory of the Mondrian project;

6) Import the necessary jar packages according to the compiled error.

Note: 1, the final implementation of ant completion of the project to clean up processing;
2, if everything is normal, then do not need to use the Mondrian.jar file, you can follow this as the standard test whether the build success.

The steps to import JPivot source are as follows:

Directly in your Mondrian project under the new Src/jpivot, and then jpivot-1.8.0/src/java the east test into the line, this will not elaborate

After the import is successful, you can delete the Jpivot.jar.

To configure a data source:

I. How to use ODBJ:

Control Panel, management tools, data Source (ODBC), click Add, select Driver do Microsoft Access (*.mdb), next set the data source name Mondr Ianfoodmart Database Selection (Mondrian-3.0.0.10550/demo/access/mondrianfoodmart.mdb)

Two. Other databases:

Execute the following command in your Mondrian/web-inf directory (Italic section needs to be adjusted yourself)

JAVA-CP "lib/mondrian.jar;lib/log4j-1.2.8.jar;lib/eigenbase-resgen.jar;lib/commons-logging-1.0.4.jar;lib/ eigenbase-xom.jar;lib/eigenbase-properties.jar;lib/Mysql.jar" mondrian.test.loader.mondrianfoodmartloader-verbose-tables-data-indexes-jdbcdrivers=Com.mysql.jdbc.Driver -inputfile=lib/foodmartcreatedata.sql -outputjdbcurl= "Jdbc:mysql://localhost:3306/foodmart ? user=root&password=admin"

Under test:

1) under your Mondrian project, create a new one containing the main function test class to create a connection:

Connection conn=drivermanager.getconnection (String,bool);

The contents of the string to be tested are:

Access:

"Jdbc=jdbc:odbc:mondrianfoodmart; Catalog=file:///d:/workspace/mondrian Engineering/webapp/web-inf/queries/foodmart.xml; Jdbcdrivers=sun.jdbc.odbc.jdbcodbcdriver; “

The parameters of the database connection are defined in string, along with the path to the schema file (CataLog).

Attention:

1 Provider=mondrian This sentence is necessary, Mondrian generated connection when the value of the Provider is a separate check, no this sentence or Provider for other values, will trigger an exception;

2 The second parameter defines the catalog, if defined in string, with a value of NULL (remember to copy the Foodmart.xml to the D:/workspace/mondrian Project/webapp/web-inf/queries directory);

3 mondrian2.x and mondrian3.x have larger changes, for the getconnection () function, the mondrian3.x has only two parameters, 2.x has three parameters.
2) Define the query statement:

String querystr = "SELECT {[measures].[ Unit Sales]} on columns "+
"From Sales"

Note: Query statements must conform to MDX syntax;

3) Use connection to generate a query object:

Query query = conn.pasequery (QUERYSTR);

4) Execute the query to get the result:

result = Conn.execute (query);

5) Console Printing results:

PrintWriter pw = new PrintWriter (System.out);

Result.print (PW);

Pw.flush ();

If the above tests were successful by stating Mondrian and the data source configuration, the following configuration JPivot let the Web project run:

1) Open the mondrian/webroot/web-inf/queries under the mondrian.jsp, set the next data source what, see you understand ...

2) The project is published to the Tomcat-----run-Http://localhost:8080/mondrian, the page has several demos, including several links will be error, this is the official demo has a problem, we need to manually modify the following, modify the method as follows ( Modified method pasted on the Web):

**************************************************************************************

1 (Error) * Various queries formatted using the Mondrian tag-library

Find content in Web. xml

<context-param>
<param-name>connectString</param-name>
<param-value>@[email protected]</param-value>
</context-param>

Modify the ConnectString as follows (Access combo uses default ODBC)

<context-param>
<param-name>connectString</param-name>
<!--the Test of "Various queries formatted using the Mondrian tag-library"-
<param-value>Provider=mondrian; Jdbc=jdbc:odbc:mondrianfoodmart; Catalog=/web-inf/queries/foodmart.xml; Jdbcdrivers=sun.jdbc.odbc.jdbcodbcdriver;</param-value>
</context-param>

2 "(Error) * Basic interface for ad hoc queries

Find content in Web. xml

<servlet>
<servlet-name>MDXQueryServlet</servlet-name>
<servlet-class>mondrian.web.servlet.MDXQueryServlet</servlet-class>
<init-param>
<param-name>connectString</param-name>
<param-value>@[email protected]</param-value>
</init-param>
</servlet>

Modify the ConnectString as follows (Access combo uses default ODBC)

<servlet>
<servlet-name>MDXQueryServlet</servlet-name>
<servlet-class>mondrian.web.servlet.MDXQueryServlet</servlet-class>
<init-param>
<param-name>connectString</param-name>
<!--the Test of "Basic interface for ad hoc queries"-
<param-value>Provider=mondrian; Jdbc=jdbc:odbc:mondrianfoodmart; Catalog=/web-inf/queries/foodmart.xml; Jdbcdrivers=sun.jdbc.odbc.jdbcodbcdriver;</param-value>
</init-param>
</servlet>

3 (Error) * JPivot pivot table by XMLA

4 (Error) * XML for Analysis tester

The above two can be solved together, find/web-inf/datasources.xml, here defines a datasource, we can create a new datasource

<DataSource>
<DataSourceName>Provider=Mondrian;DataSource=AccessTest;</DataSourceName>
<datasourcedescription>mondrian FoodMart Data warehouse</datasourcedescription>
<URL>http://localhost:8888/mondrian/xmla</URL> <DataSourceInfo>Provider=mondrian; Local=zh_cn;dynamicschemaprocessor=mondrian.i18n.localizingdynamicschemaprocessor; Jdbc=jdbc:odbc:mondrianfoodmart; Catalog=/web-inf/queries/foodmart.xml; Jdbcdrivers=sun.jdbc.odbc.jdbcodbcdriver;</datasourceinfo>
<ProviderName>Mondrian</ProviderName>
<ProviderType>MDP</ProviderType>
<AuthenticationMode>Unauthenticated</AuthenticationMode>
<Catalogs>
<catalog name= "FoodMart" >
<Definition>/WEB-INF/queries/FoodMart.xml</Definition>
</Catalog>
</Catalogs>
</DataSource>

We define a datasource called "Accesstest". Next open/web-inf/queries/xmla.jsp, will replace datasource= "Provider=mondrian;datasource=mondrianfoodmart;" Replace with datasource= "provider=mondrian;datasource=accesstest;" , because the default Mondrianfoodmart data source is associated to the Oracle database, and we stole access:)

****************************************************************************************

"Go" mondrian+jpivot Source import Eclipse and configure the data source

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.