Skip to Main Content

Java Database Connectivity (JDBC)

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!

invalid file handle when running os command passing arguments from oracle plsql call

johnnyJun 5 2014 — edited Oct 15 2014

when call program with command having no arguments = success

when calling program with command having arguments = epic fail: java.io.ioException: cannot run programĀ  ... the handle is invalid.

when calling program with command having arguments, but not passing them = program returns expected result that command is missing argument/parms.

not a java guru, I GREATLY appreciate anyone's help with this.

'CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED javaOsCall as

import java.io.*;

public class javaOsCall {

public static void executeCommand(String[] command) {

try {

final Process pr = Runtime.getRuntime().exec(command);

pr.waitFor();

new Thread(new Runnable(){

public void run() {

BufferedReader br_in = null;

try {

br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));

String buff = null;

while ((buff = br_in.readLine()) != null) {

System.out.println(buff);

try {Thread.sleep(100); } catch(Exception e) {}

}

br_in.close();

...

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2014
Added on Jun 5 2014
11 comments
989 views