Team LiB   Previous Section   Next Section

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 how Perl DBI allows Perl programs to include appropriate API calls to OCI for certain common database operations. But what if the calls available through Perl DBI are insufficient? Developers and DBAs wanting more sophisticated access to database operations — for example, specialized data loading, use of multiple database connections, and so on — have been faced with a choice between sticking with Perl (and limiting what they could do) and being forced to use C (in order to have full access to everything OCI has to offer). But now there's a new game in town — the Perl module Oracle::OCI.

    Team LiB   Previous Section   Next Section