Chapter 7. Invoking the Oracle Call Interface with Oracle::OCI

Back in Chapter 1, we introduced the Oracle Call Interface (OCI), the low-level application programming interface (API) provided by Oracle Corporation that allows the outside world access to the Oracle database engine. The 3GL language most often used to interact with OCI is C, although it is also possible to use higher-level languages like Perl to communicate with the database via OCI.

Although it is possible to access OCI directly, doing so is quite complicated, and most DBAs and developers (who fear being lost in a swirling river of pointers, linked lists, and casts) prefer a simpler and more convenient interface such as Perl DBI, which we introduced in Chapter 2. Perl DBI is actually not database-specific. It can be used to communicate with Oracle, SQL Server, MySQL, and a variety of other databases. When communicating with Oracle, Perl DBI requires the Oracle-specific driver, DBD::Oracle, also described in Chapter 2.

The Perl DBI connection to OCI via DBD::Oracle is a useful one, and for many years it has represented the only convenient way that Perl programs could communicate with Oracle. The main design goal of Perl DBI is to provide a consistent, easy-to-use interface to a variety of databases. It isn’t especially optimized for any specific database. As a result, the Perl DBI interface to OCI is rather limited; it allows access to only a subset of the extensive functionality of OCI. Back in Chapter 2 we described ...

Get Perl for Oracle DBAs now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.