Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Running perl DBI in PLSQL on UNIX

Re: Running perl DBI in PLSQL on UNIX

From: IANAL_VISTA <IANAL_Vista_at_hotmail.com>
Date: Sat, 02 Apr 2005 15:39:44 GMT
Message-ID: <Xns962C4DF232D08SunnySD@68.6.19.6>


katiesoh_at_gmail.com wrote in
news:1112447259.251703.129350_at_o13g2000cwo.googlegroups.com:

> Hi,
> I'm having trouble executing my perl DBI program in PLSQL. The perl
> program connects to an Oracle 9203 database, does some DML and DDL and
> then writes the output to STDOUT and a file.
>
> I have the following java method that I call from my PLSQL.
>
> public class execperl{
> public static execperl(String paramfile){
> Process p = Runtime.getRuntime().exec("/tmp/myperlpgm " +
> paramfile);
> }
> }
>
> I did some troubleshooting by placing print statements at various lines
> in my code and the program always stop before the OPEN statement. If I
> comment the OPEN, it exits when I do a subroutine call.
>
> The java stored procedure works fine in PLSQL if I run simple command
> like /bin/ls or a simple perl script that does some printing to STDOUT.
>
> Are there any restriction/limitation with what I'm trying to
> accomplish?
>
> Thanks.
>
> kat
>

I've read this thread thru Sybrand's 2nd post at 06:52 PST. I must admit I'm confused WRT who is calling what in which order.

I may be 100% wrong but I suspect the you are getting out to the PERL code automagically from inside the DB. However the shell in which PERL is functioning mostly like has limited to ZERO environmental variables defined.

You might need to do some thing similar to the following:

sub set_oracle_env {
   $ENV{ORACLE_TERM} = 'xsun';
   $ENV{ORACLE_BASE} =
        -d '/a/oracle' ? '/a/oracle' :
      -d '/b/oracle' ? '/b/oracle' :
         die "Can't find an oracle dbd installation";
   $ENV{ ORACLE_HOME }     = "$ENV{ ORACLE_BASE }/product/9.2.0";
   $ENV{ LD_LIBRARY_PATH } = "$ENV{ ORACLE_HOME }/lib:/usr/local/lib";
   $ENV{ ORACLE_OWNER }    = 'oracle';
   $ENV{ PATH }            = "$ENV{ ORACLE_HOME }/bin:$ENV{ PATH }";
   $ENV{ NLS_LANG }        = 'american_america.we8iso8859p1';
   $ENV{ ORA_NLS }         = "$ENV{ ORACLE_HOME }/ocommon/nls/admin/data";
   $ENV{ ORA_NLS32 }       = "$ENV{ ORACLE_HOME }/ocommon/nls/admin/data";
} Received on Sat Apr 02 2005 - 09:39:44 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US