This is not a problem on the server side from the command line. As I showed
it worked. The Java script which I am trying to run this through dies
displaying the system errno of 2 which I did a perl -e '$!=2; print "$!\n";'
and received the Operation not applicable. So I guess I may need to post
the JavaScript being used. I am not a Java programmer so I got this script
from the asktom site. This is the code he gave to run a Unix command from
the Oracle database. This may be just a little to picky for my needs.
Bellow is where I continue to get the system error from. That is why I was
watching $!. Thank you for that $! reference.
1
2java source named "Util"
3 as
4 import java.io.*;
5 import java.lang.*;
6
7 public class Util extends Object
8 {
9
10 public static int RunThis(String[] args)
11 {
12 Runtime rt = Runtime.getRuntime();
13 int rc = -1;
14
15 try
16 {
17 Process p = rt.exec(args[0]);
18
19 int bufSize = 4096;
20 BufferedInputStream bis =
21 new BufferedInputStream(p.getInputStream(), bufSize);
22 int len;
23 byte buffer[] = new byte[bufSize];
24
25 // Echo back what the program spit out
26 while ((len = bis.read(buffer, 0, bufSize)) != -1)
27 System.out.write(buffer, 0, len);
28
29 rc = p.waitFor();
30 }
31 catch (Exception e)
32 {
33 e.printStackTrace();
34 rc = -1;
35 }
36 finally
37 {
38 return rc;
39 }
40 }
41 }
42 /
When run from a function which returns the value of "rc" from above
Wrote file afiedt.buf
1 begin
2 dbms_output.put_line('VALUE OF RC = '||run_cmd('/home/user/file.pl user
pass'));
3* end;
VALUE OF RC = 2
PL/SQL procedure successfully completed.
This is the hinge for my project. Without being able to call this perl
script from an Oracle Form I might as well close shop. This works with
other scripts but once DBI is used it crashes and always returns a 2.
Thanks
Adam
> -----Original Message-----
> From: Ronald J Kimball [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, July 02, 2002 9:10 AM
> To: Hapworth, Adam
> Cc: Job Miller; [EMAIL PROTECTED]
> Subject: Re: Getting a non fatal error after Connect to Oracle
>
> On Tue, Jul 02, 2002 at 08:50:02AM -0400, Hapworth, Adam wrote:
> >
> > I found that were were previously set but I set them in the script
> according
> > to the DBD::Oracle docs. Here is a trimed down script and then the
> output I
> > am receiving.
> > NOTE: I receive a "No such file or directory" for :0 and :1 if I do not
> > include the "use Data::Dumper;" line. I am still not sure why.
>
> `perldoc perlvar`
>
> $! If used in a numeric context, yields the current
> value of errno, with all the usual caveats. (This
> means that you shouldn't depend on the value of $!
> to be anything in particular unless you've gotten
> a specific error return indicating a system
> error.) If used in a string context, yields the
> corresponding system error string.
>
> Note the parenthetical.
>
> >
> > #!/usr/bin/perl5 -w
> > print $?."0\n";
> > print $!.":0\n";
> >
> > [snip code containing further invalid uses of $!]
>
> Don't print $! unless you've actually gotten a system error, such as from
> open().
>
> Ronald