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: Start a program from wthin Oracle

Re: Start a program from wthin Oracle

From: Tim X <timx_at_spamto.devnul.com>
Date: 29 Dec 2002 23:25:23 +1100
Message-ID: <87el81ko5o.fsf@tiger.rapttech.com.au>


"Moritz Klein" <mklein_at_students.uni-mainz.de> writes:

> Tim X wrote:
> >
> > I have done this with a java stored procedure. You don't need JNI. All
> > you need to do is use the java runtime object. Just create the java
> > stored procedure and call it as you would call any stored
> > procedure. You can find details about this at Tom Kytes site (or in
> > his book Expert one-on-one Oracle I think). Check out
> >
> > http://asktom.oracle.com
> >
> Hello,
> can you tell me the class or interface you used to start batch-scripts from
> within the JAVA-program? I took a look at the site you mentioned but could
> not find something about this.
>

There is no specific class for running batch-scripts from within java. However, java does have a Runtime class which allows you to spawn a process which can execute an arbitrary OS command. Essentially, all your java class has to do is have a static method which accepts a String (which represents the command to run e.g. the script name). This string is then passed to the Runtime object. Its a little more complicated due to you having to handle errors etc, but thats about it.

Go back to the http://asktom.oracle.com site a look a bit harder - there are a number of articles related to this issue. To start with, click on the "Most Popular" link at the top of the page. Then scroll down the page until you see the items

"Java procedure for host calls on Unix environments"

and

"How do I execute and executable from PL/SQL"

These should be enough to get you started.

Tim

-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!
Received on Sun Dec 29 2002 - 06:25:23 CST

Original text of this message

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