|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmondrian.olap4j.MondrianOlap4jDriver
public class MondrianOlap4jDriver
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).
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.
Constructor Summary | |
---|---|
MondrianOlap4jDriver()
Creates a MondrianOlap4jDriver. |
Method Summary | |
---|---|
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.sql.DriverPropertyInfo[] |
getPropertyInfo(java.lang.String url,
java.util.Properties info)
|
(package private) java.lang.String |
getVersion()
Returns the driver version. |
boolean |
jdbcCompliant()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
MondrianOlap4jDriver()
Method Detail |
---|
public java.sql.Connection connect(java.lang.String url, java.util.Properties info) throws java.sql.SQLException
connect
in interface java.sql.Driver
java.sql.SQLException
public boolean acceptsURL(java.lang.String url) throws java.sql.SQLException
acceptsURL
in interface java.sql.Driver
java.sql.SQLException
public java.sql.DriverPropertyInfo[] getPropertyInfo(java.lang.String url, java.util.Properties info) throws java.sql.SQLException
getPropertyInfo
in interface java.sql.Driver
java.sql.SQLException
java.lang.String getName()
java.lang.String getVersion()
public int getMajorVersion()
getMajorVersion
in interface java.sql.Driver
public int getMinorVersion()
getMinorVersion
in interface java.sql.Driver
public boolean jdbcCompliant()
jdbcCompliant
in interface java.sql.Driver
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |