Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Run a MS DOS batch file from the client

RakinMay 20 2008 — edited May 20 2008
Hi,

I created a java source to run a bat file, the folder is loacted in the Database server.
(Not in application server)

create or replace and compile java source named execcommand as
import java.io.*;
import java.util.*;
public class ExecCommand{
public static void run(String cmdstr) throws IOException, InterruptedException
{
try {
int rtn;
cmdstr = "cmd /c " + cmdstr;
Process prcs = Runtime.getRuntime().exec(cmdstr);
while (prcs.getInputStream().read() != -1 ) {}
}
catch (IOException e) {
e.printStackTrace();
}
}
}

I called the java source from the procedure

create or replace procedure run_batfile is
begin

execcommand(cmdtext => 'e:\services\genPDF.bat');
dbms_output.put_line('file created successfully');
exception
when others then
dbms_output.put_line(sqlcode || sqlerrm);

end run_batfile;


But the bat is not executing (The bat file is to generate a PDF file ). Bu when i executing this from my PC (Client PC) directly on the RUN , its generating the PDF file in the server.
What could be the problem, What should be the path in the procedure,

Shall i create any virtual directory ?

Thanks in advance,

Rizly
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 17 2008
Added on May 20 2008
5 comments
1,285 views