Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Java Procedure Doesn't Exist When Executed
> Resant wrote:
> You mean the name must be case sensitive? I think is not. It's still
> doesn't work.
> Any other idea please?
>
> Thanks,
>
> Resant
Hi again Resant. Java class names are case sensitive. I have modified *your* code to demonstrate what it should look like/included inline below.
The error that occurs at the end of the script is a privilege issue.
Oracle tells you in the error message what privs are necessary & how to
grant them.
Regards
Mike
TESSELLA Michael.OShea_at_tessella.com
__/__/__/ Tessella Support Services plc __/__/__/ 3 Vineyard Chambers, ABINGDON, OX14 3PX, England __/__/__/ Tel: (44)(0)1235-555511 Fax: (44)(0)1235-553301www.tessella.com Registered in England No. 1466429
SQL>
SQL> CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Whatever" AS
2 import java.io.*;
3 public class ExecCommand
4 {
5 public static int runCommand(String cmd) throws IOException
6 {
7 Process proc = Runtime.getRuntime().exec(cmd); 8 try 9 { 10 proc.waitFor(); 11 } 12 catch (InterruptedException e) 13 { 14 System.err.println("process was interrupted"); 15 return -1; 16 } 17 18 if (proc.exitValue() != 0) 19 { 20 System.err.println("exit value was non-zero"); 21 return -2; 22 } 23 24 // return success 25 return 0;
Java created.
SQL> SQL> SQL> CREATE OR REPLACE FUNCTION EXEC_COMMAND(Command IN varchar2)RETURN
Function created.
SQL>
SQL> SELECT exec_command('dir') FROM DUAL;
*
SQL> SELECT *
2 FROM V$VERSION;
BANNER
SQL> SQL> SQL>Received on Tue Jun 13 2006 - 02:29:37 CDT