Programmer's Guide to the Oracle Call Interface
Release 8.0

A54656_01

Library

Product

Contents

Index

Prev Next

F
Oracle8 OCI New Features

This chapter provides a detailed overview of the new features of the Oracle8 OCI. This information supplements that which is contained in Chapter 1, "Introduction and New Features". This chapter includes the following sections:

Introduction

The Oracle Call Interface (OCI) is an application programming interface (API) that allows an application developer to use a third-generation language's native procedures or function calls to access the Oracle database server and control all phases of SQL statement execution. The OCI provides a library of standard database access and retrieval functions in the form of a dynamic runtime library, OCILIB, that can be linked in by the application. This eliminates the need to embed SQL or PL/SQL within 3GL programs. The OCI supports the datatypes, calling conventions, syntax and semantics of a number of third-generation languages including C, C++, COBOL and FORTRAN. Oracle is also planning to provide support for Java.

The Oracle Call Interface offers programmers the following key benefits:

Oracle8 OCI Enhancements

The Oracle8 OCI has many new features that can be broadly categorized in two primary areas:

Encapsulated/Opaque Interfaces

All the data structures that are used by Oracle8 OCI are encapsulated in the form of opaque interfaces that are called handles. A handle is an opaque pointer to a storage area allocated by the OCILIB that stores context information, connection information, error information, or bind information about a SQL or PL/SQL statement. A client allocates a certain type of handle, populates one or more of those handles through well-defined interfaces, and sends requests to the server using those handles. In turn, applications can access the specific information contained in the handle by using accessor functions. The Oracle8 OCI library manages a hierarchy of handles. Encapsulating the OCI interfaces using these handles has several benefits to the application developer including:

Simplified User Authentication and Password Management

The Oracle8 OCI provides application developers simplified user authentication and password management in two ways: (i) it provides the ability for a single OCI application to authenticate and maintain multiple users, and (ii) Allows the application to update a user's password which is particularly helpful if an expired password message is returned by an authentication attempt.

The Oracle8 OCI supports two types of login sessions:

Extensions to Improve Application Performance and Scalability

The Oracle8 OCI has several enhancements to improve application performance and scalability. Application performance has been improved by reducing the number of client to server round trips required and scalability improvements have been facilitated by reducing the amount of state information that needs to be retained on the server side. Some of these features include:

Consistent Interface for Transaction Management

The Oracle8 OCI supports several improvements to provide a single unified interface for transaction management in a variety of configurations. Some of the major improvements are:

Oracle8 OCI Object Support

The Oracle8 OCI provides the most comprehensive application programming interface for programmers seeking to use the Oracle8 server's object capabilities. These features can be divided into five major categories:

Client-side Object Cache

The object cache is a client-side memory buffer that provides lookup and memory management support for objects. It stores and tracks objects instances which have been fetched by an OCI application from the server to the client side. The object cache is created when the OCI environment is initialized. Multiple applications running against the same server will each have their own object cache. The cache tracks the objects which are currently in memory, maintains references to objects, manages automatic object swapping and tracks the meta-attributes or type information about objects. The cache provides the following OCI applications:

Associative and Navigational Interfaces

Applications using the Oracle8 OCI can access objects in the Oracle8 server through two types of interfaces - (i) Using SQL SELECT, INSERT, and UPDATE statements and (ii) Using a C-style "pointer chasing" scheme to access objects in the client-side cache by traversing the corresponding smart pointers or REFs

Runtime Environment for Objects

The Oracle8 OCI provides a runtime environment for objects that offers a set of functions for managing how Oracle8 objects are used on the client-side. These functions provide the necessary functionality for:

Type Management, Mapping and Manipulation Functions

The Oracle8 OCI provides two sets of functions to work with Oracle8 objects:

Additionally, the OCIDescribeAny() function can provide information about objects stored in the database.

Object Type Translator

The Object Type Translator (OTT) utility translates schema information about Oracle8 object types into client-side language bindings. That is, the Oracle8 OTT translates type information into declarations of host language variables (structures and classes). The OTT takes an "intype" file which contains metadata information about Oracle8 schema objects (an Oracle8 data dictionary) and generates an "outtype" file and the necessary header/implementation files that must be included in a C application that runs against the object schema. Both OCI applications (and Pro*C precompiler) applications may include code generated by the OTT. The OTT has many benefits including:

Improves application developer productivity: OTT eliminates the need for application developers to write by hand the host language variables that correspond to schema objects.

Maintains SQL as the data-definition language of choice: By providing the ability to automatically map Oracle8 schema objects that are created using SQL to host language variables automatically, OTT facilitates using SQL as the data-definition language of choice. This in turn allows Oracle8 to support a consistent model of the user's data, enterprise-wide.

Facilitates schema evolution of object types: OTT provides the ability to regenerate #include files when the schema is changed allowing Oracle8 applications to support schema evolution.

OTT is typically invoked from the command line by specifying the intype file, the outtype file and the specific database connection. With Oracle8, OTT can only generate C structs which can either be used with OCI programs or with the Pro*C precompiler programs.

Benefits of the OCI's New Features

The enhancements to the new OCI provide several benefits:

Each of these benefits is described below.

Comprehensive Support for Oracle8 Objects

As has been described above, the OCI provides the most comprehensive support for Oracle8 objects of all the programmatic interfaces and provides the most highly tunable interface to access, modify and manipulate Oracle8 object types on the client side. Further, the many tools and features of the OCI significantly enhance developer productivity when creating applications that use Oracle8 objects.

Improved Application Performance

The Oracle8 OCI facilitates improved application performance by reducing the number of client-to-server round trips in three ways.

Greater Scalability

Applications written to use Oracle8 OCI will have greater scalability due to the Oracle8 OCI's reduced use of server side memory, its ability to pool concurrent transactions, and its improved support for multi-threaded environments.

Simplified Migration of Existing Applications

The OCI has been significantly improved with many features, and applications written to work with Oracle7 OCI have a very smooth migration path to Oracle8 OCI due to the interoperability of the Oracle7 OCI (version7 client) with Oracle8 (server) and Oracle8 OCI (version 8 client) with Oracle7 (server). Specifically:

As a result, customers migrating an existing Oracle7 OCI application have the following three alternatives:

Further, if application developers need to use any of the object capabilities of the Oracle8 server, they will need to upgrade their client to use Oracle8 OCI.

Enhanced Application Extensibility

All the data structures that are used by Oracle8 OCI are encapsulated in the form of opaque interfaces that are called handles. This encapsulation of the OCI's interfaces allows changes to be made to the underlying data structures without affecting applications. For example, some of the services that are currently provided by the database and externalized through the OCI's APIs could in the future be provided by an application server. By using the OCI's opaque handles applications will not need to change significantly if accessing these services from the application server - this facilitates application extensibility.




Prev

Next
Oracle
Copyright © 1997 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index