Oracle9i OLAP Services Developer's Guide to the OLAP DML Release 1 (9.0.1) Part Number A86720-01 |
|
Defining and Working with Analytic Workspaces, 5 of 12
Typically, a Java application uses the Oracle OLAP API to access relational data. In addition, the Oracle OLAP API supports access to data that resides in an OLAP Services analytic workspace.
Through the OLAP API, a Java application can access workspace data that has been provided with analytic workspace metadata. Because analytic workspace metadata is compatible with the OLAP API multidimensional metadata (MDM) model, a Java application can manipulate workspace data using the OLAP API Java classes. For a description of the MDM model and the OLAP API classes, see the Oracle9i OLAP Services Developer's Guide to the Oracle OLAP API and the Oracle9i OLAP Services OLAP API Reference.
As an alternative access method, the OLAP API provides a way for a Java application to directly manipulate workspace data, without the need for any metadata and without the use of the OLAP API data manipulation classes. The Java application uses the SPLExecutor
class in the OLAP API to send DML commands directly to OLAP Services for execution in the workspace.
Whichever access method is used, the application establishes a connection, opens the workspace, accesses the data (either through MDM metadata or through SPLExecutor
), closes the workspace, and closes the connection. This topic describes these steps.
To make a connection, follow the steps described in the chapter about connecting to a data store in the Oracle9i OLAP Services Developer's Guide to the Oracle OLAP API. The chapter describes how the OLAP service makes a connection to its parent Oracle database instance. This connection is a requirement even if your application will only access data in an OLAP Services workspace.
When you have connected to the workspace, you will have a Connection
object that represents the connection.
Use the openDatabase
method on the Connection
object to open the workspace that you want to access. The openDatabase
method requires the following two parameters:
DATABASE CREATE FORECAST
Properties
object that specifies parameters that are appropriate for opening the workspace. The Properties
object contains one or more properties, each of which represents one parameter. If you are opening a workspace that has analytic workspace metadata, then you must specify a property called "DatabaseType", with a value of "ECM".
To discover if there are other required or optional parameters, use the getConnectionParameterInfo
method on the Connection
object, as described in the reference page for the Connection
class in the Oracle9i OLAP Services OLAP API Reference.
The openDatabase
method returns the Database
object that represents the workspace.
The OLAP API provides classes that support the MDM model for describing a set of data. These classes are in the mdm
package of the OLAP API.
Ordinarily, the data that an application analyzes is stored in an Oracle database, and it has been provided with MDM-compatible metadata through the OLAP management feature of Oracle Enterprise Manager. However, if your workspace has been provided with analytic workspace metadata, the OLAP API can use the workspace data for analysis, because its analytic workspace metadata is MDM-compatible.
To access analytic workspace metadata and the data that it represents, create an MdmMetadataProvider
, as described in the chapter on discovering metadata in the Oracle9i OLAP Services Developer's Guide to the Oracle OLAP API. When you create the MdmMetadataProvider
, specify the Database
object that represents the workspace.
To navigate the metadata, create queries, and fetch data, use the procedures that are described in the Oracle9i OLAP Services Developer's Guide to the Oracle OLAP API.
The OLAP API provides the SPLExecutor
class, through which you can execute DML commands or evaluate DML expressions in a workspace. You create an SPLExecutor
object, specifying your Connection
object as a parameter. Then you call the executeCommand
method on your SPLExecutor
to send commands to the OLAP service, or you call one of several methods for evaluating expressions.
Depending on the evaluation method that you use, the return value is a boolean
, int
, double
, or other Java data type. An executed command always returns a String
.
For more information about the SPLExecutor
methods, see the reference page for this class in the Oracle9i OLAP Services OLAP API Reference.
When you are finished with your work, call the close
method on the Database
object that represents your workspace. This method closes the Database
object, and the OLAP service detaches the workspace that is associated with it.
When you no longer need the connection, call the close
method on the Connection
object. This method terminates the connection that was made on behalf of your application with the Oracle database instance, and the method terminates the connection between your application and the OLAP service.
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|