Package mondrian.olap4j
Class MondrianOlap4jDriver
- java.lang.Object
-
- mondrian.olap4j.MondrianOlap4jDriver
-
- All Implemented Interfaces:
java.sql.Driver
public class MondrianOlap4jDriver extends java.lang.Object implements java.sql.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 extensionOlapConnection
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
-
-
Constructor Summary
Constructors Constructor Description MondrianOlap4jDriver()
Creates a MondrianOlap4jDriver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptsURL(java.lang.String url)
java.sql.Connection
connect(java.lang.String url, java.util.Properties info)
int
getMajorVersion()
int
getMinorVersion()
(package private) java.lang.String
getName()
Returns the driver name.java.util.logging.Logger
getParentLogger()
java.sql.DriverPropertyInfo[]
getPropertyInfo(java.lang.String url, java.util.Properties info)
(package private) java.lang.String
getVersion()
Returns the driver version.boolean
jdbcCompliant()
-
-
-
Field Detail
-
factory
protected final Factory factory
-
-
Method Detail
-
connect
public java.sql.Connection connect(java.lang.String url, java.util.Properties info) throws java.sql.SQLException
- Specified by:
connect
in interfacejava.sql.Driver
- Throws:
java.sql.SQLException
-
acceptsURL
public boolean acceptsURL(java.lang.String url) throws java.sql.SQLException
- Specified by:
acceptsURL
in interfacejava.sql.Driver
- Throws:
java.sql.SQLException
-
getPropertyInfo
public java.sql.DriverPropertyInfo[] getPropertyInfo(java.lang.String url, java.util.Properties info) throws java.sql.SQLException
- Specified by:
getPropertyInfo
in interfacejava.sql.Driver
- Throws:
java.sql.SQLException
-
getParentLogger
public java.util.logging.Logger getParentLogger()
- Specified by:
getParentLogger
in interfacejava.sql.Driver
-
getName
java.lang.String getName()
Returns the driver name. Not in the JDBC API.- Returns:
- Driver name
-
getVersion
java.lang.String getVersion()
Returns the driver version. Not in the JDBC API.- Returns:
- Driver version
-
getMajorVersion
public int getMajorVersion()
- Specified by:
getMajorVersion
in interfacejava.sql.Driver
-
getMinorVersion
public int getMinorVersion()
- Specified by:
getMinorVersion
in interfacejava.sql.Driver
-
jdbcCompliant
public boolean jdbcCompliant()
- Specified by:
jdbcCompliant
in interfacejava.sql.Driver
-
-