next up previous
Next: The CORBA Message Logger Up: CORBA OBJECTS FOR SLS Previous: The Event Channel Interface

The CORBA Oracle Interface

The CORBA database server provides access to the Oracle8i database management system[16] by utilizing the Oracle Call Interface (OCI8 for Oracle8) through the C++ Oracle Template Library (OTL)[17]. The OTL templates are expanded into direct database API function calls which are transmitted to the Oracle database server using the Oracle Net8 network protocol. An high-level CORBA interface to Oracle is particularly appropriate as the overhead of building and then parsing textual commands is small compared to the cost of locating and reading the data from disk.

The CORBA application objects developed typically handle three fundamental data types: a database connection, a Standard Query Language (SQL) statement and the corresponding results returned following execution of the statement. A connection to the database is first created by specifying the name of the database and the corresponding password. An SQL handle is then initialized with the SQL command that is to be executed. Once executed, for SQL queries returning data, a result set is delivered from which individual results may be requested. A description of the columns appearing in the SQL statement is also returned by quering standard Oracle database tables. The results are delivered in a separate class that can be interrogated when, for example, the typedef of a column is unknown.

 
Table 4: Database access from a Java client.

$\backslash\backslash$ Holder for results set from SQL query
BdDbSqlRetSeqHolder DbSqlRetSeq =
new BdDbSqlRetSeqHolder();
$\backslash\backslash$ Holder for column description
BdDbHeaderSeqHolder DbHeaderSeq =
new BdDbHeaderSeqHolder();
CORBA::String sqlStatement, stat;
$\backslash\backslash$ Prepare SQL statement (default database)
sqlStatement="Select sum(val),avg(val) from Table";
$\backslash\backslash$ Remote method invocation
status= Dbref.BdDbOtlSelect
(sqlStatement, DbHeaderSeq, DbSqlRetSeq);
$\backslash\backslash$ Print error message if any
if(stat!="") System.out.println("sqlStat: " +stat);
$\backslash\backslash$ Print selected results from SQL query
System.out.println(DbSqlRetSeq.value[0].retDouble[0]
+"=Sum & Avg="+DbSqlRetSeq.value[0].retDouble(1));
$\backslash\backslash$ Print all rows from SQL query
BdDbPrint(DbHeaderSeq, DbSqlRetSeq);

 

The CORBA implementation provides easy access to the Oracle database as illustrated in Table 4 which lists a Java client performing a database retrieval operation. Methods that permit database modification operations have also been provided. Data arrays are mediated through OTL datatypes that map into Oracle BLOBs (Binary Large OBjects) or Oracle LONG RAWs.

The database server, for the most part, has been used to access static data though the storage of real-time data is foreseen.


next up previous
Next: The CORBA Message Logger Up: CORBA OBJECTS FOR SLS Previous: The Event Channel Interface
Jan Chrin
2000-11-13