CGI and Perl


The DBI:: module is a Perl5 module written by Tim Bunce that provides a common Perl interface to various database engines. DBI will allow your Perl CGI script to manipulate data contained in a database without regard for the actual database engine being used to service the requests. In other words, once you understand the syntax of the different DBI functions used to access a database, those same functions allow you to access data from an Oracle, Sybase, Informix, or whatever database precisely the same way, even though the different database engines have different 3GL API layers. The API defined by DBI will work on all supported database types.

A good example of this is a Web-based customer support application. Using DBI, your CGI could access customer information in an Oracle database, product information in an Informix database, and order status information in a Sybase database. DBI provides a single standard API that allows you to access this information from all of these databases from within the same CGI script.

DBI can be obtained from the Comprehensive Perl Archive Network (CPAN) at

or its source at

DBI implements support for the individual database engines through driver modules called DBDs. DBDs are currently available for most major database engines. Table 8.1 lists the current DBD interfaces for DBI as of this writing. The latest information on currently available modules is kept at the following URL:

The DBD module for Oracle can be obtained from CPAN or its source at

Table 8.1. DBD interfaces available for DBI.

Module Name Database Required Author
DBD::Oracle Oracle 6 or 7 Tim Bruce
DBD::Sybase Sybase Michael Peppler
DBD::Informix Informix Jonathan Leffler
DBD::mSQL mSQL 1.0.7+ Alligator Descartes
DBD::Empress Empress 6.8 Francis Jones
DBD::Fulcrum Fulcrum SearchServer 2/3 Davide Migliavacca
DBD:DB2 DB2 2.1+ Mike Moran
DBD::Interbase Interbase Bill Karwin
DBD::Quickbase NeXTStep Quickbase Ben Lindstrom
DBD::Ingres Ingres Henrik Tougaard