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: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 4 Apr 2005 10:54:17 -0700
Message-ID: <1112637257.421065.127710@o13g2000cwo.googlegroups.com>

katiesoh_at_gmail.com wrote:
> It does not appear to be related to DBI at least for now. I removed
all
> the existing perl code except the open(). Running this on Solaris 8,
> DB:9203.
>
> $> more /tmp/tmp.pl
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> $| = 1;
> print "Before STDOUT...\n\n";
> open (STDOUT,"|tee /tmp/out.log");
> print "Before STDERR...\n\n";
> open (STDERR,">&STDOUT");
> print "Before close STDERR...\n\n";
> close (STDERR);
> print "End of Prog...\n\n";
>
> I then execute my procedure,
> SQL> variable a number;
> SQL> set serveroutput on
> SQL> exec dbms_java.set_output(100000);
> SQL> exec :a:=execcmd('/tmp/tmp.pl');
> Before STDOUT...
>
> PL/SQL procedure successfully completed.
>
> It appears that the program just terminated at 'Before STDOUT'. The
> file /tmp/out.log was not created.
>
> If I run /tmp/tmp.pl on the command line, it works fine and the file
> /tmp/out.log is created.
> $> /tmp/tmp.pl
> Before STDOUT...
>
> Before STDERR...
>
> Before close STDERR...
>
> End of Prog...
>
> What am I missing?
>
> Thanks.
>
> kat

Couple of potential problems I can see.

If your perl script writes to stdout or stderr then you need to read these continously in a sort of loop in java via Process.getInput/Output/ErrorStream()... otherwise your java code may block for IO.

Redirecting to tee may be an issue since it also writes to stdout.

Regards
/Rauf Received on Mon Apr 04 2005 - 12:54:17 CDT

Original text of this message

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