Package mondrian.olap4j
Class MondrianOlap4jDriver
java.lang.Object
mondrian.olap4j.MondrianOlap4jDriver
- All Implemented Interfaces:
Driver
Olap4j driver for Mondrian.
Since olap4j is a superset of JDBC, you register this driver as you would any JDBC driver:
Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
Then create a connection using a URL with the prefix "jdbc:mondrian:". For example,
import java.sql.Connection;
import java.sql.DriverManager;
import org.olap4j.OlapConnection;
Connection connection =
DriverManager.getConnection(
"jdbc:mondrian:Jdbc=jdbc:odbc:MondrianFoodMart;
Catalog=file:/mondrian/demo/FoodMart.xml;
JdbcDrivers=sun.jdbc.odbc.JdbcOdbcDriver");
OlapConnection olapConnection =
connection.unwrap(OlapConnection.class);
Note how we use the Wrapper.unwrap(Class)
method to down-cast
the JDBC connection object to the extension OlapConnection
object. This method is only available in the JDBC 4.0 (JDK 1.6 onwards).
Connection properties
The driver supports the same set of properties as a traditional mondrian
connection. See RolapConnectionProperties
.
Catalogs and schemas
Mondrian has a sole catalog, called "LOCALDB". You will get an error
if you attempt to use Connection.setCatalog(String)
to set
it to anything else.
- Since:
- May 22, 2007
- Author:
- jhyde
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptsURL
(String url) connect
(String url, Properties info) int
int
getPropertyInfo
(String url, Properties info) boolean
-
Field Details
-
factory
protected final mondrian.olap4j.Factory factory
-
-
Constructor Details
-
MondrianOlap4jDriver
public MondrianOlap4jDriver()Creates a MondrianOlap4jDriver.
-
-
Method Details
-
connect
- Specified by:
connect
in interfaceDriver
- Throws:
SQLException
-
acceptsURL
- Specified by:
acceptsURL
in interfaceDriver
- Throws:
SQLException
-
getPropertyInfo
- Specified by:
getPropertyInfo
in interfaceDriver
- Throws:
SQLException
-
getParentLogger
- Specified by:
getParentLogger
in interfaceDriver
-
getMajorVersion
public int getMajorVersion()- Specified by:
getMajorVersion
in interfaceDriver
-
getMinorVersion
public int getMinorVersion()- Specified by:
getMinorVersion
in interfaceDriver
-
jdbcCompliant
public boolean jdbcCompliant()- Specified by:
jdbcCompliant
in interfaceDriver
-