Home » SQL & PL/SQL » SQL & PL/SQL » oscmd.sql (Red Hat Linux, Oracle 10G 1.2)
oscmd.sql [message #389253] Fri, 27 February 2009 16:50 Go to next message
selezeus
Messages: 3
Registered: February 2009
Junior Member
Im using the oscmd.sql PL/SQL procedure to execute operating system command (Im working in RedHat Linux).

Normally , for simple operating commands it work more than enought good.

But, when I try to execute an litle scrip like, by example :
'java -jar /usr/bin/jxl.jar -xml Test.xls > pp1'

It dont work properly. In the caso of example it create pp1 file but nothing more.

I dont know exactly how I can resolve this problem, because I dont know how to face it.

Can it be a grants problem?
Maybe oscmd.sql cannot do this?
?????

Thanks in advanced.
Regards everybody
Re: oscmd.sql [message #389255 is a reply to message #389253] Fri, 27 February 2009 17:18 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
http://www.ensta.fr/~diam/java/online/io/javazine.html

See solution above, or the easier way is to call a wrapper shell script from pl/sql and that script contains whatever shell meta-charaters you want < | > etc.

my_script.sh
------------------
java -jar /usr/bin/jxl.jar -xml Test.xls > pp1
Re: oscmd.sql [message #389257 is a reply to message #389255] Fri, 27 February 2009 17:32 Go to previous messageGo to next message
selezeus
Messages: 3
Registered: February 2009
Junior Member
Thanks for your answerd.

I have this command wrapper into a script.

the oscmd.sql that you can see here :

http://www.orafaq.com/scripts/plsql/oscmd.txt

but when I execute this java program, (host) to execute the script it dont give results.
If I execute directly the scrip (sh myscript.sh) it work perfect.

Then the script is properly write. But when I execute this script from oscmd it fail.

Regards.
Re: oscmd.sql [message #389258 is a reply to message #389257] Fri, 27 February 2009 17:49 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
remember to set your Java env variables in the script before you try to run the java command. A good idea is to dump your env settings to a temp file to see what's actually there before you call your command.

my_script.sh
------------------
export JAVA_HOME=....
env | sort > /tmp/my_env.txt
java -jar /usr/bin/jxl.jar -xml Test.xls > pp1
Re: oscmd.sql [message #389259 is a reply to message #389258] Fri, 27 February 2009 17:52 Go to previous message
selezeus
Messages: 3
Registered: February 2009
Junior Member
You are right, I need test this.

Thanks again.
Regards.
Previous Topic: A few simple questions
Next Topic: Greatest Function
Goto Forum:
  


Current Time: Mon Dec 05 13:16:47 CST 2016

Total time taken to generate the page: 0.08285 seconds