Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: OCI tutorial/description

Re: OCI tutorial/description

From: Tim Smith <tssmith_at_best.com>
Date: 1996/12/29
Message-ID: <32c5e4cd.142825351@nntp.best.com>#1/1

On Sat, 28 Dec 1996 14:25:01 -0800, jdaly_at_atscanada.com (Jim Daly) wrote:

>The Oracle Call Interface is a (very) low level interface to the Oracle
>server and requires a fairly deep understanding of the interface
>architecture, especially as it related to managing internal structures
>such as cursors. The interface is defined in the OCI documentation,
>consisting of a general manual, and language specific manuals. Unless
>you need to implement low level data access directly, you should avoid
>using OCI. You should be able to do do everything you need through the
>pre-compilers (Pro*c, etc.). If you want to experiment, there are some
>examples on the distribubtion, under the ../oci72/samples directory.

I'm not sure exactly what Jim means by low-level access. It is certainly true that for simple DML statements, and even for many DDL statements, a precompiler application is easier to code than an OCI application, since you have to declare special data structures in the OCI program, and you have to take steps (like opening a cursor for any SQL statement, and doing the parsing and host variable binding "by hand"), that the precompiler does for you in the simple cases.

But if you are doing complicated stuff, like dynamic queries where you do not know ahead of time the construction of the tables involved, I find the OCI more intuitive, and easier to use than, say, Pro*C. The precompilers get into some exotic stuff at this level. (A heritage of the original IBM-ish SQLDA spec.)

C programmers who are contemplating writing an OCI program should have a look at the second OCI demo program, available as cdemo2.c on the Oracle server distribution (for Windows NT, and Oracle 7.3, it is available in C:\ORANT\OCI73\SAMPLES\MSVC\CDEMO2.C (substitute your Oracle Home for C:\ORANT). If you can follow this after a few hours study, you should have no problems writing any OCI program at all for any 7.x server. The code is not extensively commented (mea culpa--I wrote it), but it shouldn't be too difficult to follow.

The OCI changes a lot for Oracle8.0, but existing 7.x OCI programs will run against Oracle8 with no changes (I've done it). To take advantage of the new Oracle8 functionality, such as objects, be prepared to learn a lot of new function calls and data structures. But you will have access to all of the Oracle8 functionality through the OCI. In summary, if you are serious about writing code that works against Oracle6/7/8, you will be well-repaid by learning the OCI.

--Tim (tssmith_at_best.com) (tssmith_at_us.oracle.com)

These are my opinions, and are not necessarily those of Oracle Corp. Received on Sun Dec 29 1996 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US