Class MDXOlap4jConnection
java.lang.Object
org.pentaho.platform.plugin.services.connections.mondrian.MDXOlap4jConnection
- All Implemented Interfaces:
org.pentaho.commons.connection.IPentahoConnection
public class MDXOlap4jConnection
extends Object
implements org.pentaho.commons.connection.IPentahoConnection
MDXOlap4jConnection implements IPentahoConenction to support olap4j connections to any olap4j provider. Developers
may subclass MDXOlap4jConnection to unwrap the olap4j connection to directly manipulate the underlying connection. An example of this is
setting a DelegatingRole in the case of Mondrian.
- Version:
- $Id: $
- Author:
- Benny Chow
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.olap4j.OlapConnection
Underlying connection to OLAP system.Fields inherited from interface org.pentaho.commons.connection.IPentahoConnection
CLASSNAME_KEY, CONNECTION, CONNECTION_NAME, DRIVER_KEY, HQL_DATASOURCE, JNDI_NAME_KEY, KEYS, LOCATION_KEY, MDX_DATASOURCE, MDX_OLAP4J_DATASOURCE, NONE_DATASOURCE, PASSWORD_KEY, PROVIDER, QUERY_KEY, SQL_DATASOURCE, USERNAME_KEY, XML_DATASOURCE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears any warnings cached by the connection.void
close()
Closes the connection.boolean
connect
(Properties props) Sets the properties to be used when the connection is made.org.pentaho.commons.connection.IPentahoResultSet
executeQuery
(String arg0) Executes the specified query against the connection.org.olap4j.OlapConnection
Returns the underlying connection to OLAP system.Returns the type of connection.Retrieves the string representation of the last executed query.org.pentaho.commons.connection.IPentahoResultSet
Returns resultset of the last executed query.boolean
Checks if the connection is initialized or not.boolean
isClosed()
Checks if the connection is closed or not.boolean
Checks if the connection is read only or not.org.pentaho.commons.connection.IPentahoResultSet
prepareAndExecuteQuery
(String arg0, List arg1) Builds the query based on the pattern and parameters list and executes it against the connection.boolean
Checks if the given connection supports prepared queries.void
setFetchSize
(int arg0) Sets size of the fetch buffer used when retrieving rows from the underlying database.void
setMaxRows
(int arg0) Sets maximum rows that will be returned by the next query.void
setProperties
(Properties props) Sets the properties to be used when the connection is made.
-
Field Details
-
connection
protected org.olap4j.OlapConnection connectionUnderlying connection to OLAP system.
-
-
Constructor Details
-
MDXOlap4jConnection
public MDXOlap4jConnection()
-
-
Method Details
-
close
public void close()Closes the connection.- Specified by:
close
in interfaceorg.pentaho.commons.connection.IPentahoConnection
-
connect
Sets the properties to be used when the connection is made. The standard keys for the properties are defined in this interface.- Specified by:
connect
in interfaceorg.pentaho.commons.connection.IPentahoConnection
- Parameters:
props
- Properties to be used for creating connection. This particular method relies on the following properties: url, driver, user, password.
-
executeQuery
Executes the specified query against the connection.- Specified by:
executeQuery
in interfaceorg.pentaho.commons.connection.IPentahoConnection
- Parameters:
query
- SQL-like query string. May be data source specific.- Returns:
- Returns result set of the query.
-
getResultSet
public org.pentaho.commons.connection.IPentahoResultSet getResultSet()Returns resultset of the last executed query.- Specified by:
getResultSet
in interfaceorg.pentaho.commons.connection.IPentahoConnection
- Returns:
- Returns the resultset from the last query executed.
-
initialized
public boolean initialized()Checks if the connection is initialized or not.- Specified by:
initialized
in interfaceorg.pentaho.commons.connection.IPentahoConnection
- Returns:
- Returns true if the connection has been properly initialized.
-
isClosed
public boolean isClosed()Checks if the connection is closed or not.- Specified by:
isClosed
in interfaceorg.pentaho.commons.connection.IPentahoConnection
- Returns:
- Returns true if this connection has been closed.
-
isReadOnly
public boolean isReadOnly()Checks if the connection is read only or not.- Specified by:
isReadOnly
in interfaceorg.pentaho.commons.connection.IPentahoConnection
- Returns:
- Returns true if this connection is read only. NOTE: Current implementation for all connections is read only.
-
prepareAndExecuteQuery
public org.pentaho.commons.connection.IPentahoResultSet prepareAndExecuteQuery(String arg0, List arg1) throws Exception Builds the query based on the pattern and parameters list and executes it against the connection.- Specified by:
prepareAndExecuteQuery
in interfaceorg.pentaho.commons.connection.IPentahoConnection
- Parameters:
arg0
- SQL-like query string. May be data source specific.arg1
- List of objects to bind into prepared query.- Returns:
- Returns result set of the query.
- Throws:
Exception
-
preparedQueriesSupported
public boolean preparedQueriesSupported()Checks if the given connection supports prepared queries.- Specified by:
preparedQueriesSupported
in interfaceorg.pentaho.commons.connection.IPentahoConnection
- Returns:
- Returns true if the connection supports prepared queries.
-
setFetchSize
public void setFetchSize(int arg0) Sets size of the fetch buffer used when retrieving rows from the underlying database.- Specified by:
setFetchSize
in interfaceorg.pentaho.commons.connection.IPentahoConnection
- Parameters:
fetchSize
- The buffer size.
-
setMaxRows
public void setMaxRows(int arg0) Sets maximum rows that will be returned by the next query.- Specified by:
setMaxRows
in interfaceorg.pentaho.commons.connection.IPentahoConnection
- Parameters:
maxRows
- Maximum rows that are returned by the next query.
-
setProperties
Sets the properties to be used when the connection is made. It connects to the OLAP system described by the properties. The standard keys for the properties are defined in IPentahoConnection interface.- Specified by:
setProperties
in interfaceorg.pentaho.commons.connection.IPentahoConnection
- Parameters:
props
- Properties to be used when the connection is made.
-
clearWarnings
public void clearWarnings()Clears any warnings cached by the connection.- Specified by:
clearWarnings
in interfaceorg.pentaho.commons.connection.IPentahoConnection
-
getDatasourceType
Returns the type of connection.- Specified by:
getDatasourceType
in interfaceorg.pentaho.commons.connection.IPentahoConnection
- Returns:
- Returns the type of the connection.
-
getLastQuery
Retrieves the string representation of the last executed query.- Specified by:
getLastQuery
in interfaceorg.pentaho.commons.connection.IPentahoConnection
- Returns:
- Returns the last query string executed.
-
getConnection
public org.olap4j.OlapConnection getConnection()Returns the underlying connection to OLAP system.- Returns:
- Returns the underlying connection.
-