Coder Social home page Coder Social logo

olap4j-xmlaserver's Introduction

Build Status

olap4j

Olap4j is an open Java API for accessing OLAP data.

It is an extension to JDBC. For example, its OlapConnection class extends java.sql.Connection, from which you can create an OlapStatement, and execute to create a CellSet (analogous to a java.sql.ResultSet). There are also similar mechanisms for browsing metadata. As a result, olap4j is easy to learn if you have JDBC experience and know a little about OLAP.

Prerequisites

Olap4j requires ant (version 1.7 or later) and JDK 1.7 to build. (Once built, it also runs under JDK 1.5 and 1.6.)

Download and build

$ git clone git://github.com/olap4j/olap4j.git
$ cd olap4j
$ ant

Writing a simple program

You can now write and run a simple program against olap4j. For example, you can write:

import org.olap4j.*;
import org.olap4j.metadata.Member;
import java.sql.*;

Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
Connection connection =
    DriverManager.getConnection(
        "jdbc:xmla:Server=http://example.com:8080/mondrian/xmla");
OlapConnection olapConnection = connection.unwrap(OlapConnection.class);
OlapStatement statement = olapConnection.createStatement();
CellSet cellSet =
    statement.executeOlapQuery(
        "SELECT {[Measures].[Unit Sales]} ON 0,\n"
        + "{[Product].Children} ON 1\n"
        + "FROM [Sales]");
for (Position row : cellSet.getAxes().get(1)) {
    for (Position column : cellSet.getAxes().get(0)) {
        for (Member member : row.getMembers()) {
            System.out.println(member.getUniqueName());
        }
        for (Member member : column.getMembers()) {
            System.out.println(member.getUniqueName());
        }
        final Cell cell = cellSet.getCell(column, row);
        System.out.println(cell.getFormattedValue());
        System.out.println();
    }
}

Or, if you are using the in-process mondrian driver, include mondrian.jar and its dependencies in your classpath, and change the appropriate lines in the above code to the following:

Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
Connection connection =
    DriverManager.getConnection(
        "jdbc:mondrian:"
        + "Jdbc='jdbc:odbc:MondrianFoodMart';"
        + "Catalog='file://c:/open/mondrian/demo/FoodMart.xml';"
        + "JdbcDrivers=sun.jdbc.odbc.JdbcOdbcDriver;");

Packages and Roadmap

The core API of olap4j version 1.0 is a Long Term Support (LTS) release, but some parts of the olap4j project will remain considered as experimental, thus subject to change in future releases.

Core packages are as follows:

The following packages are considered experimental and are subject to change:

Version 2.0

Olap4j version 2.0 is currently under development. Goals are:

  • Support metadata and API changes in recent SSAS (Microsoft SQL Server Analysis Services) and XMLA (XML for Analysis)
  • Support metadata and API changes in Mondrian version 4

We aim to be backwards compatible in the same way that each JDBC release is backwards compatible:

  • Applications developed against earlier versions will work against 2
  • Drivers supporting version 2 will also serve as 1.x drivers (JDBC version 4 broke this rule, and it was painful for driver developers)
  • Some work will be required to convert a version 1.x driver to a version 2 driver

Version 2 specification is here.

More information

General project information:

Related projects:

If you have downloaded a release:

  • README.txt describes the release structure.
  • CHANGES.txt describes what has changed in the release.
  • The VERSION.txt file holds the version number of the release.

olap4j-xmlaserver's People

Contributors

julianhyde avatar lucboudreau avatar mkambol avatar pentaho-nbaker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

olap4j-xmlaserver's Issues

Connection question

Just as we can see in Connection properties :

the Property Server need a URL of HTTP server. Required.

But in many case use a http is not fast enough.

So, I wonder if I can use another way to connect.

Just like Excel, we can connect to our olap server use http://my-pc/olap/msmdpump.dll, and we can also use my-pc\sql2012 as well.

Remove Xerces

According to a quicks search, we only depend on Xerces because of a constants class. We should copy this over and remove the dependency.

Sample web.xml for olap-xmlaserver

My intent is to access Mondrian via HTTP/XMLA. I compiled the olap-xmlaserver project, created a war and put together a web.xml file based on the source code, but I'm getting an exception when the server processes an xmla request. Is there a sample web.xml to get started?

This is what I have:

<servlet>
    <servlet-name>xmla</servlet-name>
	<servlet-class>mondrian.xmla.impl.Olap4jXmlaServlet</servlet-class>
	
      <init-param>
         <param-name>OlapDriverClassName</param-name>
         <param-value>com.mysql.jdbc.Driver</param-value>
      </init-param>
	
	  <init-param>
         <param-name>OlapDriverConnectionString</param-name>
         <param-value>
             jdbc:mondrian:Jdbc=jdbc:mysql://localhost:3306/foodmart?user=root&amp;password=xxx;Catalog=/WEB-INF/FoodMart.xml;JdbcDrivers=com.mysql.jdbc.Driver;
         </param-value>
      </init-param>
		
  </servlet>
    
  <servlet-mapping>
    <servlet-name>xmla</servlet-name>
    <url-pattern>/xmla</url-pattern>
  </servlet-mapping>

And the exception

Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'jdbc:mondrian:Jdbc=jdbc:mysql://localhost:3306/foodmart?user=root&password=bank;Catalog=/WEB-INF/FoodMart.xml;JdbcDrivers=com.mysql.jdbc.Driver;'
        at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
        at mondrian.xmla.impl.Olap4jXmlaServlet$Olap4jPoolingConnectionFactory.getConnection(Olap4jXmlaServlet.java:300)
        at mondrian.xmla.XmlaHandler.getConnection(XmlaHandler.java:2917)
        ... 34 more
Caused by: java.sql.SQLException: No suitable driver
        at java.sql.DriverManager.getDriver(DriverManager.java:315)
        at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
        ... 38 more

I'm positive that the problem is related to a miss-configuration.

MDX XmlaHandler.executeQuery() doesn't release connection if everything is ok

hello,
Thanks for your project. I'm experimenting with the own olap4j driver impl.

  • the problem starts from Olap4jPoolingConnectionFactory.getConnection() where the underlying connection (from my driver) is wrapped by dbcp.
  • as far as I understand this dbcp connection should be released by closing at XmlaHandler.executeQuery() however it's occurs if(!success) only
  • however there might be an attempt for closing it by closing result in XmlaHandler.execute() which leads to the
MDDataSet.close() {
            cellSet.getStatement().getConnection().close();
        }

that closes connection from underlying driver, but not the dbcp connection wrapper, that leaks it.

WDYT? How we can to elaborate this issue?
So far, I'll try to nuke the connection pooling.

XMLA error when defining more than 1 DataSource in datasources.xml

Hi,

not sure, if this is a problem of mondrian or olap4j-xmla or olap4j-xmlaserver project:

I'm running Saiku from trunk (http://ci.analytical-labs.com/job/saiku-mondrian4/), including

  • Mondrian 4.0
  • olap4j-1.2.0-SNAPSHOT.jar
  • olap4j-xmla-1.2.0-SNAPSHOT.jar
  • olap4j-xmlaserver-1.2.0.jar
  • foodmart database.

When I set up datasources.xml with only 1 DataSource section, everythin works fine. Connecting to the XMLA-server works with different datasources, each in combination with different frontends.

When I set up datasources.xml with 2 DataSource sections, I get the following error. The error occurs independently from frontends, so it should be a matter of mondrian or xmla components. I both tried with an own datasource as 2nd DataSource section and (to eleminate other sources of error) with just a copy of the 1st datasource as 2nd DataSource.

Here is the error message:

2014-07-08 09:04:07,674 DEBUG [mondrian.xmla.XmlaServlet] XML/A response content
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >
<SOAP-ENV:Header>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
  <faultcode>SOAP-ENV:Server.00HSBE02</faultcode>
  <faultstring>XMLA Discover unparse results error</faultstring>
  <faultactor>Mondrian</faultactor>
  <detail>
    <XA:error xmlns:XA="http://mondrian.sourceforge.net">
      <code>00HSBE02</code>
      <desc>The Mondrian XML: java.lang.AssertionError</desc>
    </XA:error>
  </detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This datasources.xml is working without errors:

<?xml version="1.0"?>
<DataSources>
<DataSource>
<DataSourceName>Provider=Mondrian;DataSource=FoodMart</DataSourceName>
<DataSourceDescription>Foodmart Data Warehouse</DataSourceDescription>
<URL>http://localhost:8080/mondrian/xmla</URL>
<DataSourceInfo>Provider=mondrian;Jdbc=jdbc:hsqldb:res:foodmart/foodmart;JdbcDrivers=org.hsqldb.jdbcDriver;Catalog=/WEB-INF/classes/foodmart/FoodMart.xml</DataSourceInfo>
<ProviderName>Mondrian</ProviderName>
<ProviderType>MDP</ProviderType>
<AuthenticationMode>Authenticated</AuthenticationMode>
<Catalogs>
<Catalog name="FoodMart">
<Definition>/WEB-INF/classes/foodmart/FoodMart.xml</Definition>
</Catalog>
</Catalogs>
</DataSource>
</DataSources>

This one works, but only 1 datasource ist shown up in the frontend (1:1 copy of the 1st DataSource section)

<?xml version="1.0"?>
<DataSources>
<DataSource>
<DataSourceName>Provider=Mondrian;DataSource=FoodMart</DataSourceName>
<DataSourceDescription>Foodmart Data Warehouse</DataSourceDescription>
<URL>http://localhost:8080/mondrian/xmla</URL>
<DataSourceInfo>Provider=mondrian;Jdbc=jdbc:hsqldb:res:foodmart/foodmart;JdbcDrivers=org.hsqldb.jdbcDriver;Catalog=/WEB-INF/classes/foodmart/FoodMart.xml</DataSourceInfo>
<ProviderName>Mondrian</ProviderName>
<ProviderType>MDP</ProviderType>
<AuthenticationMode>Authenticated</AuthenticationMode>
<Catalogs>
<Catalog name="FoodMart">
<Definition>/WEB-INF/classes/foodmart/FoodMart.xml</Definition>
</Catalog>
</Catalogs>
</DataSource>
<DataSource>
<DataSourceName>Provider=Mondrian;DataSource=FoodMart</DataSourceName>
<DataSourceDescription>Foodmart Data Warehouse</DataSourceDescription>
<URL>http://localhost:8080/mondrian/xmla</URL>
<DataSourceInfo>Provider=mondrian;Jdbc=jdbc:hsqldb:res:foodmart/foodmart;JdbcDrivers=org.hsqldb.jdbcDriver;Catalog=/WEB-INF/classes/foodmart/FoodMart.xml</DataSourceInfo>
<ProviderName>Mondrian</ProviderName>
<ProviderType>MDP</ProviderType>
<AuthenticationMode>Authenticated</AuthenticationMode>
<Catalogs>
<Catalog name="FoodMart">
<Definition>/WEB-INF/classes/foodmart/FoodMart.xml</Definition>
</Catalog>
</Catalogs>
</DataSource>
</DataSources>

This one gives the error message, no datasource ist shown up in the frontend (1:1 copy of the 1st DataSource section, modified in DataSourceName only)

<?xml version="1.0"?>
<DataSources>
<DataSource>
<DataSourceName>Provider=Mondrian;DataSource=FoodMart</DataSourceName>
<DataSourceDescription>Foodmart Data Warehouse</DataSourceDescription>
<URL>http://localhost:8080/mondrian/xmla</URL>
<DataSourceInfo>Provider=mondrian;Jdbc=jdbc:hsqldb:res:foodmart/foodmart;JdbcDrivers=org.hsqldb.jdbcDriver;Catalog=/WEB-INF/classes/foodmart/FoodMart.xml</DataSourceInfo>
<ProviderName>Mondrian</ProviderName>
<ProviderType>MDP</ProviderType>
<AuthenticationMode>Authenticated</AuthenticationMode>
<Catalogs>
<Catalog name="FoodMart">
<Definition>/WEB-INF/classes/foodmart/FoodMart.xml</Definition>
</Catalog>
</Catalogs>
</DataSource>
<DataSource>
<DataSourceName>Provider=Mondrian;DataSource=FoodMart2</DataSourceName>
<DataSourceDescription>Foodmart Data Warehouse</DataSourceDescription>
<URL>http://localhost:8080/mondrian/xmla</URL>
<DataSourceInfo>Provider=mondrian;Jdbc=jdbc:hsqldb:res:foodmart/foodmart;JdbcDrivers=org.hsqldb.jdbcDriver;Catalog=/WEB-INF/classes/foodmart/FoodMart.xml</DataSourceInfo>
<ProviderName>Mondrian</ProviderName>
<ProviderType>MDP</ProviderType>
<AuthenticationMode>Authenticated</AuthenticationMode>
<Catalogs>
<Catalog name="FoodMart">
<Definition>/WEB-INF/classes/foodmart/FoodMart.xml</Definition>
</Catalog>
</Catalogs>
</DataSource>
</DataSources>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.