zoukankan      html  css  js  c++  java
  • HelloMondrian1Mondrian连接sqlserver2008的中文例子

    写在前面的话:

    偶然机会开始学习bi,研究了几个月的MS的AS工具,总觉得不够得心应手,接触到Mondrian,自己特别喜欢Java,所以想好好研究一下,在网上见到很多前辈的资料,不够系统,也都有些不同的问题,我在这里就把我自己学习过程中遇到的问题和解决办法分享出来,喜欢Mondrian的朋友,大家一起学习,让新手可以快速入门,心急的朋友可以从step1直接开始,我觉得学习新知识实践很重要,希望照着我的step你能够由浅入深的学会Mondrion,大家一起分享,我觉得是一件快乐的事情。

    这里是第一篇,我主要写一个目录,方便大家查阅我的相关的Mondrian001;HelloMondrian0--HelloMondrian学习目录url=


    开发环境:Myeclipse,SqlServer2008R2,tomcat


    本文目的:建立可以运行的HelloMondrion项目,让新手可以快速入门,心急的朋友可以从step1直接开始,我觉得学习新知识实践很重要,希望照着我的step你能够由浅入深的学会Mondrion,大家一起分享,我觉得是一件快乐的事情。


    开始前的准备:

    --有关Mondrion的介绍可以看这里:http://www.oschina.net/p/mondrian

    --Mondrion官网地址:http://sourceforge.net/projects/mondrian/files/,在这里可以下载到最新的Mondrion

    其他的入门材料可以在本文后面的下载链接下载,我提供了一些来自网上的还不错的资料。


    step1.下载Mondrion程序包,最新的版本是3.4.1,下载地址:http://nchc.dl.sourceforge.net/project/mondrian/mondrian/mondrian-3.4.1/mondrian-3.4.1.zip

    我下载的版本是3.4.1。


    step2.在Myeclipse中建立javaweb项目HelloMondrian(这步不会的给我留言,这步要是不会我觉得先去学习java吧)


    step3.用压缩工具打开压缩包,在lib目录下有Mondrian.war文件,用压缩软件解压该文件(在打开方式里面选择你自己的解压工具,这个很简单,如果你有更好的办法可以留言告诉我,目的就是获取其中的文件)由于这一部分没有难度,我不写太详细,不清楚的可以参考我本文结尾给出的参考资料。解压后获得一个Mondrian文件夹后,

    复制:复制jpivot,wcf,WEB-INF文件夹,testpage.jsp文件共4个到Myeclipse项目HelloMondrian的WebRoot下。注意复制过程覆盖了几个文件和文件夹,重要的是:web.xml


    step4.这时候在HelloMondrian的web-INF下有了多个文件夹,刚才复制过来的,确保有lib,queries,在queries下新建jsp页面tezz.jsp,如下:

    <%@ page session="true" contentType="text/html; charset=UTF-8" %>
    <%@ taglib uri="http://www.tonbeller.com/jpivot" prefix="jp" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <jp:mondrianQuery id="query01" 
    catalogUri="/WEB-INF/queries/tezz.xml" 
    jdbcDriver="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
    jdbcUrl="jdbc:sqlserver://localhost:1433;DatabaseName=TestDB"
    jdbcUser="sa"
    jdbcPassword="1234"
    >
    select 
    {[Measures].[数量],[Measures].[平均单价],[Measures].[总销售额]} on columns,
    {([产品类别].[所有产品],[客户性别].[所有性别])} 
    on rows
    from [Sales]
    
    </jp:mondrianQuery>
    <c:set var="title01" scope="session">Sales</c:set>

    step5:建立数据库,我在sqlserver2008R2中的脚本为:

    create database TestDB
    --建表语句:建立4张表 /**1、销售表*/ create table Sale (saleId int not null, proId int null, cusId int null, unitPrice float null, --单价 number int null, --数量 constraint PK_SALE primary key (saleId)) /**2、用户表*/ create table Customer ( cusId int not null, gender char(1) null, --性别 constraint PK_CUSTOMER primary key (cusId)) /**3、产品表*/ create table Product ( proId int not null, proTypeId int null, proName varchar(32) null, constraint PK_PRODUCT primary key (proId)) /**4、产品类别表*/ create table ProductType (proTypeId int not null, proTypeName varchar(32) null, constraint PK_PRODUCTTYPE primary key (proTypeId)) --数据准备 --插入数据 insert into Customer(cusId,gender) values(1,'F') insert into Customer(cusId,gender) values(2,'M') insert into Customer(cusId,gender) values(3,'M') insert into Customer(cusId,gender) values(4,'F') insert into producttype(proTypeId,proTypeName) values(1,'电器') insert into producttype(proTypeId,proTypeName) values(2,'数码') insert into producttype(proTypeId,proTypeName) values(3,'家具') insert into product(proId,proTypeId,proName) values(1,1,'洗衣机') insert into product(proId,proTypeId,proName) values(2,1,'电视机') insert into product(proId,proTypeId,proName) values(3,2,'mp3') insert into product(proId,proTypeId,proName) values(4,2,'mp4') insert into product(proId,proTypeId,proName) values(5,2,'数码相机') insert into product(proId,proTypeId,proName) values(6,3,'椅子') insert into product(proId,proTypeId,proName) values(7,3,'桌子') insert into sale(saleId,proId,cusId,unitPrice,number) values(1,1,1,340.34,2) insert into sale(saleId,proId,cusId,unitPrice,number) values(2,1,2,140.34,1) insert into sale(saleId,proId,cusId,unitPrice,number) values(3,2,3,240.34,3) insert into sale(saleId,proId,cusId,unitPrice,number) values(4,3,4,540.34,4) insert into sale(saleId,proId,cusId,unitPrice,number) values(5,4,1,80.34,5) insert into sale(saleId,proId,cusId,unitPrice,number) values(6,5,2,90.34,26) insert into sale(saleId,proId,cusId,unitPrice,number) values(7,6,3,140.34,7) insert into sale(saleId,proId,cusId,unitPrice,number) values(8,7,4,640.34,28) insert into sale(saleId,proId,cusId,unitPrice,number) values(9,6,1,140.34,29) insert into sale(saleId,proId,cusId,unitPrice,number) values(10,7,2,740.34,29) insert into sale(saleId,proId,cusId,unitPrice,number) values(11,5,3,30.34,28) insert into sale(saleId,proId,cusId,unitPrice,number) values(12,4,4,1240.34,72) insert into sale(saleId,proId,cusId,unitPrice,number) values(13,3,1,314.34,27) insert into sale(saleId,proId,cusId,unitPrice,number) values(14,3,2,45.34,27)

    未完待续

  • 相关阅读:
    1030 完美数列 (25 分)
    1029 旧键盘 (20 分)
    数据库命令失败原因汇总
    代码有中文括号,导致错误
    win10笔记本触控板使用指南
    (已解决)vsC#控制台应用添加System.Windows.Forms引用失败(精通C#)
    ildasm中Ctrl+M闪退的问题(已解决, 精通C# 15.1)
    C#控制台应用(.NET Core)添加System.Windows.Forms失败(已解决)
    知识点_指针_增加对指针的理解
    自己写出的Bug_应是%f却写成%d
  • 原文地址:https://www.cnblogs.com/qinche/p/2614351.html
Copyright © 2011-2022 走看看