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
FieldsModifier and TypeFieldDescriptionprotected org.olap4j.OlapConnectionUnderlying 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears any warnings cached by the connection.voidclose()Closes the connection.booleanconnect(Properties props) Sets the properties to be used when the connection is made.org.pentaho.commons.connection.IPentahoResultSetexecuteQuery(String arg0) Executes the specified query against the connection.org.olap4j.OlapConnectionReturns the underlying connection to OLAP system.Returns the type of connection.Retrieves the string representation of the last executed query.org.pentaho.commons.connection.IPentahoResultSetReturns resultset of the last executed query.booleanChecks if the connection is initialized or not.booleanisClosed()Checks if the connection is closed or not.booleanChecks if the connection is read only or not.org.pentaho.commons.connection.IPentahoResultSetprepareAndExecuteQuery(String arg0, List arg1) Builds the query based on the pattern and parameters list and executes it against the connection.booleanChecks if the given connection supports prepared queries.voidsetFetchSize(int arg0) Sets size of the fetch buffer used when retrieving rows from the underlying database.voidsetMaxRows(int arg0) Sets maximum rows that will be returned by the next query.voidsetProperties(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:
closein 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:
connectin 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:
executeQueryin 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:
getResultSetin 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:
initializedin 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:
isClosedin 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:
isReadOnlyin 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:
prepareAndExecuteQueryin 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:
preparedQueriesSupportedin 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:
setFetchSizein 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:
setMaxRowsin 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:
setPropertiesin 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:
clearWarningsin interfaceorg.pentaho.commons.connection.IPentahoConnection
-
getDatasourceType
Returns the type of connection.- Specified by:
getDatasourceTypein interfaceorg.pentaho.commons.connection.IPentahoConnection- Returns:
- Returns the type of the connection.
-
getLastQuery
Retrieves the string representation of the last executed query.- Specified by:
getLastQueryin 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.
-