public interface OlapConnection extends Connection, OlapWrapper
OlapConnection is a subclass of Connection
. It can be pooled
by a connection pooling framework or obtained directly via the Java
standard DriverManager
. The JDBC URL prefix of olap connections
is dependent of the driver implementation. Such implementations are,
among others possible:
Olap connections have a different metadata hierarchy than regular
JDBC. The connection's metadata is available using
getMetaData()
, and returns a specialized subclass
of DatabaseMetaData
. The objects at the root of the hierarchy
are Database
class objects.
A connection needs be bound to a database, a catalog and a schema. Implementations are expected to automatically discover these if no driver specific parameters indicated which ones to use.
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
Modifier and Type | Method and Description |
---|---|
Scenario |
createScenario()
Creates a Scenario.
|
OlapStatement |
createStatement() |
List<String> |
getAvailableRoleNames()
Returns a list of the names of roles that are available for this user to
execute queries.
|
String |
getCatalog()
Returns the
Catalog name which is currently active for this
connection. |
String |
getDatabase()
Returns the database name currently active for this connection.
|
Locale |
getLocale()
Returns this connection's locale.
|
OlapDatabaseMetaData |
getMetaData() |
Catalog |
getOlapCatalog()
Returns the current active
Catalog
of this connection. |
NamedList<Catalog> |
getOlapCatalogs()
Returns a list of
Catalog objects which
belong to this connection's OLAP server. |
Database |
getOlapDatabase()
Returns the current active
Database of this
connection. |
NamedList<Database> |
getOlapDatabases()
Returns a list of
Database objects which
belong to this connection's OLAP server. |
Schema |
getOlapSchema()
Returns the current active
Schema
of this connection. |
NamedList<Schema> |
getOlapSchemas()
Returns a list of
Schema objects which
belong to this connection's OLAP server. |
MdxParserFactory |
getParserFactory()
Returns the factory used to create MDX parsers in this connection.
|
String |
getRoleName()
Returns the name of the role in which this connection executes queries.
|
Scenario |
getScenario()
Returns this connection's active Scenario, or null if there is no
active Scenario.
|
String |
getSchema()
Returns the
Schema name that was selected for this connection,
either through the JDBC URL or via
setSchema(String) . |
PreparedOlapStatement |
prepareOlapStatement(String mdx)
Creates a prepared OLAP Statement.
|
void |
setCatalog(String catalogName)
Sets the name of the catalog that will be used for this connection.
|
void |
setDatabase(String databaseName)
Sets the name of the database that will be used for this connection.
|
void |
setLocale(Locale locale)
Sets the current locale of this connection.
|
void |
setRoleName(String roleName)
Sets the name of the role in which this connection executes queries.
|
void |
setScenario(Scenario scenario)
Sets the active Scenario of this connection.
|
void |
setSchema(String schemaName)
Sets the name of the active schema for this connection.
|
abort, clearWarnings, close, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStruct, getAutoCommit, getClientInfo, getClientInfo, getHoldability, getNetworkTimeout, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap
isWrapperFor, unwrap
isWrapperFor, unwrap
OlapDatabaseMetaData getMetaData() throws OlapException
getMetaData
in interface Connection
OlapException
- if database error occursPreparedOlapStatement prepareOlapStatement(String mdx) throws OlapException
This method is the equivalent, for OLAP, of the
Connection.prepareStatement(String)
JDBC method.
mdx
- MDX query stringOlapException
- if database error occursMdxParserFactory getParserFactory()
OlapStatement createStatement() throws OlapException
createStatement
in interface Connection
OlapException
- if database error occursString getDatabase() throws OlapException
setDatabase(String)
, the driver will select the
first one available.OlapException
- An exception will be thrown, if any of these conditions
are true:
void setDatabase(String databaseName) throws OlapException
databaseName
- The name of the database to use.OlapException
- An exception will be thrown, if any of these conditions
are true:
Database getOlapDatabase() throws OlapException
Database
of this
connection.
If the user has not specified a database name to use for this connection, the driver will auto-select the first Database available.
OlapException
- An exception will be thrown, if any of these conditions
are true:
setDatabase(String)
,
getOlapDatabases()
NamedList<Database> getOlapDatabases() throws OlapException
Database
objects which
belong to this connection's OLAP server.
The caller should assume that the list is immutable; if the caller modifies the list, behavior is undefined.
OlapException
- if a database access error occursString getCatalog() throws OlapException
Catalog
name which is currently active for this
connection.
If the user has not specified a database name to use for this connection, the driver will automatically select the first one available. If the user has not specified a catalog name to use, the driver will also use the first one available on the server.
getCatalog
in interface Connection
OlapException
- An exception will be thrown, if any of these conditions
are true:
void setCatalog(String catalogName) throws OlapException
setCatalog
in interface Connection
catalogName
- The name of the catalog to use for this connection.OlapException
- An exception will be thrown, if any of these conditions
are true:
Catalog getOlapCatalog() throws OlapException
Catalog
of this connection.
If the user has not selected a Database and Catalog to use for this connection, the driver will auto-select the first Database and Catalog available on the server.
Any auto-discovery performed by implementations must take into account the specified database name and catalog name, if any.
OlapException
- An exception will be thrown, if any of these conditions
are true:
NamedList<Catalog> getOlapCatalogs() throws OlapException
Catalog
objects which
belong to this connection's OLAP server.
If the user has not selected a Database to use for this connection, the implementation auto-selects the first Database available. Any auto-discovery performed by implementations must take into account the connection Database parameter.
The caller should assume that the list is immutable; if the caller modifies the list, behavior is undefined.
OlapException
- An exception will be thrown, if any of these conditions
are true:
String getSchema() throws OlapException
Schema
name that was selected for this connection,
either through the JDBC URL or via
setSchema(String)
.
If the user has not selected a Database, Catalog and Schema to use for this connection, the driver will auto-select the first Database, Catalog and Schema available.
Any auto-discovery performed by implementations must take into account the specified Database, Catalog and Schema names, if any.
getSchema
in interface Connection
OlapException
- An exception will be thrown, if any of these conditions
are true:
void setSchema(String schemaName) throws OlapException
setSchema
in interface Connection
schemaName
- The name of the schema to use for this connection.OlapException
- An exception will be thrown, if any of these conditions
are true:
Schema getOlapSchema() throws OlapException
Schema
of this connection.
If the user has not selected a Database, Catalog and Schema to use for this connection, the driver will auto-select the first Database, Catalog and Schema available.
Any auto-discovery performed by implementations must take into account the specified Database, Catalog and Schema names, if any.
OlapException
- An exception will be thrown, if any of these conditions
are true:
NamedList<Schema> getOlapSchemas() throws OlapException
Schema
objects which
belong to this connection's OLAP server.
If the user has not selected a Database, Catalog and Schema to use for this connection, the driver will auto-select the first Database and Catalog available.
Any auto-discovery performed by implementations must take into account the specified Database, Catalog and Schema names, if any.
The caller should assume that the list is immutable; if the caller modifies the list, behavior is undefined.
OlapException
- An exception will be thrown, if any of these conditions
are true:
void setLocale(Locale locale)
If the locale is not set, the JDK's current locale is used (see
Locale.getDefault()
).
Most drivers support a Locale
connect-string property.
locale
- LocalegetLocale()
Locale getLocale()
setLocale(java.util.Locale)
,
MetadataElement.getCaption()
,
MetadataElement.getDescription()
void setRoleName(String roleName) throws OlapException
roleName
- Name of roleOlapException
- if role name is invalidString getRoleName()
List<String> getAvailableRoleNames() throws OlapException
OlapException
- if database error occursScenario createScenario() throws OlapException
It does not become the active scenario for the current connection.
To do this, call setScenario(Scenario)
.
OlapException
- if database error occurssetScenario(org.olap4j.Scenario)
void setScenario(Scenario scenario) throws OlapException
After setting a scenario, the client may call
Cell.setValue(java.lang.Object, org.olap4j.AllocationPolicy, java.lang.Object...)
to change the value of cells returned
from queries. The value of those cells is changed. This operation is
referred to as 'writeback', and is used to perform 'what if' analysis,
such as budgeting. See Scenario
for more details.
If scenario
is null, the connection will have no active
scenario, and writeback is not allowed.
Scenarios are created using createScenario()
.
scenario
- ScenarioOlapException
- if database error occursScenario getScenario() throws OlapException
OlapException
- if database error occurs