Database Reference
In-Depth Information
CHAPTER 22
■ ■ ■
Perl DBI and DBD::Oracle
P erl is a general-purpose, interpreted programming language that supports access to many
commonly used database systems. The documentation does not mention the fact that each
Oracle10 g and Oracle11 g ORACLE_HOME contains a Perl installation, which includes the Perl
modules DBI and DBD::Oracle for access to an ORACLE DBMS instance. Hence there is no
need to install Perl, DBI, and DBD::Oracle, 1 which requires a C compiler and a scarce resource
called time. Perl and the DBI may be used to write your own monitoring and benchmarking
tools, to extract data (including LOBs) to flat file for long term archival, and to insert or update
LOBs from operating system files. Furthermore, Perl DBI is an excellent prototyping tool. The
Perl subdirectory plus several directories within ORACLE_HOME can be copied to create a small
footprint Perl DBI Oracle client for machines that do not require a full RDBMS server installation.
Circumnavigating Perl DBI Pitfalls
Except pointing out that Perl DBI is sitting in each Oracle10 g ORACLE_HOME ready for use and
how to use it, what benefit could I possibly provide in this chapter? In my experience, users
of the Perl DBI struggle with the many ways of connecting to an ORACLE instance and how to
implement them in Perl DBI scripts, since the Perl DBI and DBD::Oracle documentation at the
Comprehensive Perl Archive Network (CPAN; http://www.cpan.org ) does not provide all the
details.
The goal of this chapter is to provide you with a comprehensive source of Perl programming in
an ORACLE environment. The following ORACLE-specific material is addressed:
Named bind variables
￿
Connecting via the TCP/IP, bequeath, and IPC protocols
Connecting with SYSDBA and SYSOPER privileges
￿
￿
Using connect strings with and without Net service names
Basically any book should be able to speak for itself. However, including in-depth coverage of
Perl, the DBI, and DBD::Oracle would be off-topic for this topic. Not to mention that it would
not fit the page count. By addressing the ORACLE-specific issues of connecting in great detail
and providing an example Perl script that does SELECT , INSERT , calls PL/SQL, and includes
1.
The Tk package, which is needed to build graphical user interfaces with Perl, is not included.
223
 
Search WWH ::




Custom Search