在oracle 存储过程中,怎么执行bat文件
1个回答
推荐于2016-04-09
展开全部
1. 授于test用户文件读写和执行命令亏雀野的权限
SQL>exec dbms_java.grant_permission('TEST'岁槐,'SYS:java.io.FilePermission','<<ALL FILES>>','read,write,execute,delete');
SQL>exec dbms_java.grant_permission('TEST','java.lang.RuntimePermission','*','writeFileDescriptor' );
2. 建立java source
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "bb" as import java.io.*;
import java.lang.*;
import java.util.*;
import java.sql.*;
import oracle.sql.*;
public class bb
{
public static void invoke_exe() throws IOException
{
Process p=Runtime.getRuntime().exec("d:/exp_74.bat");--注意/符号
try
{
p.waitFor();
}catch(InterruptedException ie){System.out.println(ie);}
}
}
/
3. 建立调用java source的存储过程CALL_BB
create or replace procedure CALL_BB
as
language java
name 'bb.invoke_exe()';
/
4. 执行CALL_BB即销喊可;
SQL>exec dbms_java.grant_permission('TEST'岁槐,'SYS:java.io.FilePermission','<<ALL FILES>>','read,write,execute,delete');
SQL>exec dbms_java.grant_permission('TEST','java.lang.RuntimePermission','*','writeFileDescriptor' );
2. 建立java source
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "bb" as import java.io.*;
import java.lang.*;
import java.util.*;
import java.sql.*;
import oracle.sql.*;
public class bb
{
public static void invoke_exe() throws IOException
{
Process p=Runtime.getRuntime().exec("d:/exp_74.bat");--注意/符号
try
{
p.waitFor();
}catch(InterruptedException ie){System.out.println(ie);}
}
}
/
3. 建立调用java source的存储过程CALL_BB
create or replace procedure CALL_BB
as
language java
name 'bb.invoke_exe()';
/
4. 执行CALL_BB即销喊可;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |