Database Reference
In-Depth Information
transaction as well as exception handling, I hope to instill enough confidence in the novice Perl
DBI user for him or her to begin coding Perl DBI scripts.
Personally, I strongly endorse the use of Perl with DBI over scripting with SQL*Plus and a
command shell such as Bourne Shell or Korn Shell. For example, error handling in Perl is much
better, several database sessions may be opened simultaneously, file operations are much
more sophisticated, and so on. Once you have some practice programming the Perl DBI, devel-
opment time will be reduced significantly. I encourage any DBA, even DBAs without prior
knowledge of Perl, to accept the challenge of learning the language. Once proficient, you will
discover that there is plenty of low-hanging fruit for its application.
If you encounter any bugs while using a Perl distribution that ships with Oracle software,
I suggest that you try a more recent Perl distribution from ActiveState ( http://www.
activestate.com ). Ac tiveState, a company that specializes in scripting languages such as Perl,
provides a free Perl distribution that includes DBD::Oracle starting with Perl release 5.10. The
DBI and DBD::ORACLE releases provided by ActiveState are more recent than those shipped
with Oracle11 g .
A Brief History of Perl and the DBI
The inventor of Perl is Larry Wall. Perl was first released in 1987. Today it is distributed under
the GNU General Public License and the Perl Artistic License. Can you keep a secret? Larry Wall
said that Perl actually stands for Pathologically Eclectic Rubbish Lister , but don't tell anyone
else he said that!
The truth is that the acronym Perl means Practical Extraction and Reporting Language.
Programming Perl , coauthored by Larry Wall 2 (a.k.a. “The Camel Book” and “The Perl Bible”)
states that “Perl is designed to make the easy jobs easy, without making the hard jobs impos-
sible” [WaCh 2000]. Although at first glance it may appear that Perl is an interpreted language,
Perl code is actually compiled and run using virtual machine technology comparable to Java.
The Perl DBI (database independent interface) is written and maintained by Tim Bunce,
author of the topic Programming the Perl DBI [Bunc 2000]. His motto is “making simple things
easy and difficult things possible.” Except designing and implementing the DBI, Tim Bunce
has been a Perl5 porter since 1994, contributing to the development of the Perl language and
many of its core modules. He provides additional information on the Perl DBI and DBD::Oracle
at http://search.cpan.org/~timb .
Setting Up the Environment for Perl and the DBI
The Perl installation distributed as part of each Oracle10 g and Oracle11 g ORACLE_HOME resides in
the directory $ORACLE_HOME/perl . It is used by Oracle Corporation's Database Control and Grid
Control administration tools. Perl DBI, being a database client, needs the ORACLE DBMS client
shared library, which contains the Oracle Call Interface (OCI) routines, for communication
with an ORACLE instance. The only obstacles on the way to leveraging the Perl DBI in $ORACLE_
HOME are locating a suitable client shared library and setting platform-specific environment
variables.
For more information on Larry Wall, see http://en.wikipedia.org/wiki/Larry_Wall .
2.
 
Search WWH ::




Custom Search