public class MondrianOlap4jDriver extends Object implements Driver
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).
The driver supports the same set of properties as a traditional mondrian
connection. See RolapConnectionProperties
.
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.
Modifier and Type | Field and Description |
---|---|
protected mondrian.olap4j.Factory |
factory |
Constructor and Description |
---|
MondrianOlap4jDriver()
Creates a MondrianOlap4jDriver.
|
Modifier and Type | Method and Description |
---|---|
boolean |
acceptsURL(String url) |
Connection |
connect(String url,
Properties info) |
int |
getMajorVersion() |
int |
getMinorVersion() |
Logger |
getParentLogger() |
DriverPropertyInfo[] |
getPropertyInfo(String url,
Properties info) |
boolean |
jdbcCompliant() |
public MondrianOlap4jDriver()
public Connection connect(String url, Properties info) throws SQLException
connect
in interface Driver
SQLException
public boolean acceptsURL(String url) throws SQLException
acceptsURL
in interface Driver
SQLException
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException
getPropertyInfo
in interface Driver
SQLException
public Logger getParentLogger()
getParentLogger
in interface Driver
public int getMajorVersion()
getMajorVersion
in interface Driver
public int getMinorVersion()
getMinorVersion
in interface Driver
public boolean jdbcCompliant()
jdbcCompliant
in interface Driver
Copyright © 2020 Hitachi Vantara. All rights reserved.