|Oracle9i OLAP Developer's Guide to the OLAP API
Release 2 (9.2)
Part Number A95297-01
Connecting to a Data Store, 3 of 6
To make a connection, perform the following steps:
These steps are explained in more detail in the rest of this topic.
Note that the
DataProvider objects that you create in these steps are the ones that you use throughout your work with the data store. For example, when you create certain
Source objects, you use methods on this
The following line of code loads a JDBC driver and registers it with the JDBC
After the driver is loaded, you can use the
DriverManager object to make a connection. For more information about loading Oracle's JDBC drivers, see the Oracle9i JDBC Developer's Guide and Reference.
The following code gets a JDBC
Connection object from the
String url = "jdbc:oracle:thin:@lab1:1521:orcl"; String user = "hepburn"; String password = "tracey"; oracle.jdbc.OracleConnection conn = (oracle.jdbc.OracleConnection) java.sql.DriverManager.getConnection(url, user, password);
This example connects user
hepburn with password
tracey to a database with SID (system identifier)
orcl. The connection is made through TCP/IP listener port
1521 of host
lab1. The connection uses the Oracle JDBC thin driver.
There are many ways to specify your connection characteristics using the
getConnection method. See the Oracle9i JDBC Developer's Guide and Reference for details.
After you have the
Connection object, you can create the required OLAP API objects,
TransactionProvider is an OLAP API interface. Therefore, in your code, you use an instance of the concrete class called
ExpressTransactionProvider. The following line of code creates a
TransactionProvider is required for creating a
DataProvider is an OLAP API abstract class. Therefore, in your code, you use an instance of the concrete subclass called
ExpressDataProvider. The following lines of code create and initialize a
DataProvider is required for creating a
ataProvider, which is described in Chapter 4, "Discovering the Available Metadata"