chanet,你好!我按照你的说法试了一下,但是我的下面的代码怎么不能编译呢?请指教! CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "test_run_exe" AS import java.lang.String; import java.sql.Timestamp; import java.lang.Runtime;public class test_run_exe {
经过很长时间的努力,我还是把它搞定啦,可是,在运行的时候,系统提示: ORA-29532: Java 调用被未捕获的 Java 例外终止: java.security.AccessControlException: the Permission (java.io.FilePermission <<ALL FILES>> execute) has not been granted to CHAOLEI. The PL/SQL to grant this is dbms_java.grant_permission( 'CHAOLEI', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute' ) 于是我按照系统提示,运行赋权命令: dbms_java.grant_permission( 'user', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute' ) 可是,我无论用sys, system登录,总是提示: ORA-00900: 无效 SQL 语句 为什么啊?着急上火,请高手指点!
我把所搞定的代码复制如下,以供大家参考: CREATE OR REPLACE and compile JAVA SOURCE NAMED "test_run_exe" AS import java.io.*; import java.util.*; public class test_run_exe{ public static String test() throws IOException { Runtime runtime = Runtime.getRuntime(); Process process = runtime.exec("cmd /c start d:\\cut_line.exe"); return("success!"); } }
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "test_run_exe" AS
import java.lang.String;
import java.sql.Timestamp;
import java.lang.Runtime;public class test_run_exe
{
public static String test()
{
Runtime.getRuntime().exec("cmd /c start d:\\cut_line.exe");
return("success!");
}
};
ORA-29532: Java 调用被未捕获的 Java 例外终止: java.security.AccessControlException: the Permission (java.io.FilePermission <<ALL FILES>> execute) has not been granted to CHAOLEI. The PL/SQL to grant this is dbms_java.grant_permission( 'CHAOLEI', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute' )
于是我按照系统提示,运行赋权命令:
dbms_java.grant_permission( 'user', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute' )
可是,我无论用sys, system登录,总是提示:
ORA-00900: 无效 SQL 语句
为什么啊?着急上火,请高手指点!
CREATE OR REPLACE and compile
JAVA SOURCE NAMED "test_run_exe" AS
import java.io.*;
import java.util.*;
public class test_run_exe{
public static String test() throws IOException {
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec("cmd /c start d:\\cut_line.exe");
return("success!"); }
}