Problems in running exe files in pl/sql using java [message #256606] |
Mon, 06 August 2007 02:02 |
shruthim
Messages: 1 Registered: August 2007 Location: Bangalore
|
Junior Member |
|
|
HI,
I have written a java stored procedure to execute an exe file in pl/sql,and i have create it sucess fully.I am able to access that class using pl/sql procedure , the code details is shown below.
SQL> create or replace and resolve java source named "Command"
2 as
3 import java.io.*;
4 import java.util.*;
5 import java.lang.*;
6 public class Command {
7
8 public static void Command1(String commandline) {
9
10 try {
11
12 String line;
13
14 Process p = Runtime.getRuntime().exec(commandline);
15
16 BufferedReader input =
17
18 new BufferedReader
19
20 (new InputStreamReader(p.getInputStream()));
21
22 while ((line = input.readLine()) != null) {
23
24 System.out.println(line);
25
26 }
27
28 input.close();
29
30 }
31
32 catch (Exception err) {
33
34 err.printStackTrace();
35
36 }
37
38 }
39
40 }
41 /
Java created.
SQL> create or replace procedure Execute_cmd(path in varchar2)
2 as
3 language java
4 name 'Command.Command1(java.lang.string)';
5 /
Procedure created.
SQL> declare
2 SCHEMA varchar2(30) := 'SYSTEM';
3 begin
4 dbms_java.grant_permission(
5 SCHEMA,
6 'SYS:java.io.FilePermission',
7 '<<ALL FILES>>',
8 'execute'
9 );
10
11 dbms_java.grant_permission(
12 SCHEMA,
13 'SYS:java.lang.RuntimePermission',
14 'writeFileDescriptor',
15 '*'
16 );
17
18 dbms_java.grant_permission(
19 SCHEMA,
20 'SYS:java.lang.RuntimePermission',
21 'readFileDescriptor',
22 '*'
23 );
24
25 commit;
26 end;
27 /
PL/SQL procedure successfully completed.
but when i am executing the procedure i am getting the following error and i am unable make out the reason.
SQL> call Execute_cmd('D:exeapp.exe');
call Execute_cmd('D:exeapp.exe')
*
ERROR at line 1:
ORA-29531: no method Command1 in class Command
please help me regarding this as soon as possible
|
|
|