-
I have created a java SP on oracle 8i to launch the excutable file . This SP works fine on WINDOWS NT/2000 plateform.
and when I execute this SP from the client machine it does the
the things which I wanted it, to do it.
When I created the SP on Oracle 8i running on HP/UX and pass the command line from sqlplus running on client machine(Windows 2000) it does nothing? I am puzzeled !!!! Why it does not execute the command on UNIX os any clue.
I am doing the following to create the SP's.
[1] Java program
Save this program in runj.java file.
import java.lang.*;
import java.io.*;
public class runj{
public static void runme(String strexe,String strdjs) {
Runtime rt = Runtime.getRuntime();
String[] callAndArgs = { strexe, strdjs };
try {
Process child = rt.exec(callAndArgs);
child.waitFor();
//System.out.println("Process exit code is: " + child.exitValue());
}
catch(IOException e) {
//System.err.println( "IOException starting process!");
}
catch(InterruptedException e)
{//System.err.println( "Interrupted waiting for process!");
}
}
}
[2] Compile this program using the following command
loadjava -verbose -resolve -schema scott -user scott/tiger runj.java
Note: run this command from the directory where runj.java file resides.
Do not use system as schema in the above command it will give u an error.
[3] Create the following SP from the sqlplus
CREATE OR REPLACE PROCEDURE RUNEXE(str1 VARCHAR2,str2 VARCHAR2)
AS
LANGUAGE JAVA
NAME 'runj.runme(java.lang.String,java.lang.String)';
[4] Execute the SP RUNEXE from sqlplus as follows
execute runexe('exp Username/password tables=tablename',' ');
Here exp is oracle Export utility replace the schema name and table name according to your database set up.
Note : I AM USING MY DBA USER ID AND PASSWORD IN EACH AND EVERY STEP NOT THE SCOTT AND TIGER.
Please tell me that it works....
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|