In addition to OCI8 and PEAR DB, ADOdb is the
third widely used method for accessing databases. It is modeled
after Microsoft’s ADO and is available with Python, another
extremely popular scripting language. Besides that, ADOdb is
thoroughly checked and adjusted to PHP5. It is more actively
maintained than PEAR DB, supporting things that PEAR DB does not
such as dynamic cursors and binding with “OUT” parameters for PL/SQL
procedures. In addition, there are many open source applications
using ADOdb. ADOdb is released under GNU public license, also known
as GPL, and can be used for free, which contributes to its recent
popularity. More about GPL can be found at
Although PEAR is integrated with PHP and the basic
PEAR modules are installed during the PHP installation itself, ADOdb
needs to be downloaded and installed manually. ADOdb is available for
http://adodb.sourceforge.net. The current version at the time of
this writing (Christmas 2004) is 4.54.
ADOdb is presented as an alternative to PEAR and
OCI8 because of the immense popularity of the original Microsoft’s ADO
(Abstract Data Objects) as well as the versatility of the library
What are the advantages of ADOdb over OCI8 and
PEAR DB? ADOdb is much simpler to use than OCI8 and packs separate
steps like parse, bind and execute into a single “execute” step.
Although ADOdb is more complex than PEAR DB, it has the support for
Oracle specific functionality, such as support for dynamic cursors,
explicit support for LOB columns and support for “OUT” parameter
binding (lacking in PEAR DB). ADOdb was written with performance as
one of the design goals. It can lessen the burden of the database
server by caching the data locally, on the web server.
ADOdb, in contrast to PEAR DB, supports and throws
exceptions, making error checking much easier. ADOdb, unlike PEAR DB,
does not use positional binds; it uses named binds instead. By good
design, the authors managed to hide the complexities and make named
binds look very easy and natural.
This chapter contains the following sections:
Connecting to Oracle and Handling Errors.
Executing Queries and Handling Result Sets.
Prepare and Execute SQL and Binds.
Caching Logging and Making it Look Pretty.
Differences from PEAR and MS ADO.
Installation of ADOdb.
This chapter follows the philosophy of the whole
book, with the installation section at the end, rather than the
beginning. This format presents the opportunity to concentrate on the
language itself and offers the reader a choice of whether to install
ADOdb in the first place.
The organization of this chapter is identical to
the organization of the chapters regarding the OCI8 and PEAR DB