extproc_perl is an Oracle external procedure library that
lets you write stored procedures in Perl.
2.50.
Not yet, but it's being investigated. If you want to
help with the Windows port, send e-mail to Jeff Horwitz or the mailing list.
Yes. See
http://www.sixgeeks.org/mailman/listinfo/extproc-perl for
more information.
Is there a public CVS repository?
There is a CVS repository, but there is no public access
yet. It will be opened up for the 2.0 release, however.
What Oracle data types are supported?
As of 1.99_05, you can use the following data types as parameters or return
values:
- VARCHAR2
- PLS_INTEGER
- REAL
- NUMBER (cast to PLS_INTEGER or REAL)
- DATE
Planned for a later release of 2.0:
- BLOB
- CLOB
- user defined types
Can I query or update the database from Perl?
Yes, with DBI callbacks. This is all done using the
existing IPC infrastructure between the database and the external procedure, so
it's extremely fast and requires no authentication. See the user's guide for
details.
Can I use any Perl module with extproc_perl?
Almost. You can use any module that does not load
arbitrary shared libraries (modules *linked* with shared libraries are okay).
The only module that comes to mind that would be affected by this is
Inline, but there may be others.
Why can't extproc_perl use the module I just installed?
It's probably an XS module built from C. You need to
relink libperlxsi.so before you can use the module. See the user's
guide for detailed instructions.
Why do I have to relink everytime I need to use a new
Perl module? How does the relink process work?
You have to relink when you want to use any XS-based
Perl module from extproc_perl. These modules are compiled from C and generate
shared objects which are loaded by Perl when you use the module. Unfortunately,
Oracle does not allow the dynamic loading of shared objects from external
procedures, which prevents these Perl modules from loading. extproc_perl works
around this by linking these shared objects into libperlxsi.so,
which is in turn linked to extproc_perl.so, the primary
extproc_perl library. It also disables DynaLoader, which stops Perl from even
trying to load shared objects at runtime. During the relink, stubs are created
for each module that makes it look like they are statically linked into Perl.
When extproc_perl is started, libperlxsi.so is loaded
automatically by the operating system before it passes control back to Oracle.
Since the module shared objects are linked to this library, they are loaded as
well. Once all dependencies are loaded, control is passed back to Oracle.
When I check the syntax of my code using
perl -cw, Perl dies with an undefined symbol error. How can I
check the syntax of my code?
The ExtProc module expects to be be run from the
interpreter embedded in extproc_perl.so. When it is loaded from the standard
Perl binary, it won't find the symbols it is expecting and will die a quick
death. If you're using version 1.99_05 or earlier, you need to comment out
the
use ExtProc; statement to work around this, but your mileage
may vary. In versions 1.99_06 and later, preload the extproc_perl.so library
by setting the
LD_PRELOAD environment variable to the full path to
extproc_perl.so and re-run the Perl command. You can do it all on one line as
follows (Bourne shell):
LD_PRELOAD=$ORACLE_HOME/lib/extproc_perl.so perl -cw foo.pl
What are all these shared libraries?
extproc_perl 1.0 only had one shared library. Version
2.0 consists of three shared libraries. Here's what they do:
extproc_perl.so
The core extproc_perl library. This is loaded by Oracle the first time any
Perl procedure is called. It is linked to libperlxsi.so.
libperlxsi.so
Contains code to bootstrap Perl XS modules and is linked to all of the Perl
module shared objects, including libExtProc.so. This library is
responsible for pulling in the module shared objects into extproc_perl before
handing control back to Oracle. This is important because Oracle won't let
Perl load shared libraries itself. It is separate from
extproc_perl.so so modules can be linked in without changing the
extproc_perl core.
libExtProc.so
This is the shared object for the ExtProc module.
How do I add paths to @INC? The standard
BEGIN block with unshift(@INC, ...); doesn't work.
The include path needs to be set in the configuration
file with the
inc_path directive. This is a colon separated list
of paths. For example:
inc_path=/home/jeff/perl/lib:/tmp/lib
I'm running 64-bit Oracle on Solaris with a 32-bit
Perl. Can I use extproc_perl?
Yes. Rebuilding Perl and all of its dependencies with
a 64-bit compiler is not always feasible (or desirable), but fortunately Oracle
provides a 32-bit version of the
extproc binary called
extproc32. You can force Oracle to use it by changing the
PROGRAM for the
PLSExtProc service in
listener.ora:
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/9.2.0)
(PROGRAM = extproc32)
)
Can I run the SQL wrapper scripts without first
changing to the trusted code directory or typing the full path to the script?
Yes. If you're using SQL*Plus, set the
SQLPATH environment variable to include the trusted code
directory.
$Id: faq.html,v 1.7 2006/04/20 15:44:18 jeff Exp $