A BI Beans application typically uses the following data stores:
BI Beans Catalog -- Contains data definitions for BI Beans objects
Oracle9i Release 1 or Release 2 database with OLAP metadata defined -- Contains OLAP data and metadata
For your program to access data and metadata, you must connect to these data stores.
To connect to data stores, you must estalish connections and a MetadataManager as described in the following process:
Establish a connection for each data store:
Instantiate a Connection
object.
Call methods of the Connection
object to specify information
to the data store.
Call the connect
method of the Connection
.
Note that you can control how the application connects to its data stores by creating your own pluggable connection drivers and registering them.
Instantiate a MetadataManager
and add each connection to the
MetadataManager
instance.
Call the MetadataManager.attach
method. This method checks
the connections that have been added to the MetadataManager
to see if they have been connected. It connects any that have not been connected.
It also initializes the MetadataManager
instance, so it can
provide information about metadata objects.
After you have connected to the BI Beans Catalog and to the Oracle OLAP data
source, then you can pass the MetadataManager to the QueryBuilder, QueryManager,
or CalcBuilder. You can also use the MetadataManager to get information about
metadata objects and to save and retrieve Persistable
components.
In the connection to the BI Beans Catalog, you must set environment
properties that the persistence service needs, before you call the connect
method. You must also set the DriverType
property of the Connection
to specify that the connection is for the Catalog.
In the connection to the Oracle9i database, you specify parameters
that Oracle OLAP requires. Again, you must set the DriverType
property
of the connection.
If you are connecting to an Oracle9i Release 1 database, then, by
default, the Connection
object for that database will instantiate
the Sun ORB (J2SE 1.3.1). If an ORB has already been created in the application
before BI Beans connects to the database, then you must set
the existing ORB on BI Beans. Note that BI Beans does not require an ORB
if you are connecting to an Oracle9i Release 2 database.
The example performs the following tasks:
Creates connections to the BI Beans Catalog and to an Oracle9i database
Constructs a MetadataManager and adds the connections to the MetadataManager
Attaches the Oracle9i database
The code in the example assumes that the variable session
exists
and is of type BISession
.
//imports import oracle.dss.connection.client.Connection; import oracle.dss.metadatamanager.client.MetadataManager; import oracle.dss.metadataUtil.MDM; // prepares the connection to the Catalog Connection catalogConnection = new Connection(); catalogConnection.setSession(session); catalogConnection.setDriverType(MDU.PERSISTENCE); // uses thick JDBC driver (default for Catalog connection) catalogConnection.setJdbcDriverType("oci8"); catalogConnection.setUsername("JDoe"); catalogConnection.setPassword("1a2b3c"); // MYSERVICE is a local net service name that // has been created using Oracle Net Configuration Assistant catalogConnection.setService("MYSERVICE"); // prepares the connection to the Oracle OLAP data source connection mdmConnection = new Connection(); mdmConnection.setSession(session); mdmConnection.setDriverType(MDU.MDM); // uses thin JDBC driver (default for OLAP connection) mdmConnection.setJdbcDriverType("thin"); mdmConnection.setHostName("myHostName"); mdmConnection.setPortNumber(1521); mdmConnection.setSID("myHostSid"); mdmConnection.setUsername("JDoe"); mdmConnection.setPassword("1a2b3c"); // the following two lines are required only when connecting to an OLAP server // for the Oracle9i Release 1 database mdmConnection.setServerType("OLAPServer"); mdmConnection.setOLAPServiceName("OLAPServer"); // instantiate the MetadataManager MetadataManager manager = new MetadataManager(); manager.setSession(session); // adds the connections to the MetadataManager manager.setConnection(catalogConnection); manager.setConnection(mdmConnection); // starts connections and the MetadataManager manager.attach();