用正常的jdbc连接并执行sql的方式肯定不行,可是又不能用C调用OCI接口,也不能用调用sqlplus传入参数的方式,请问如何实现。有没有JAVA封装OCI API的代码或例子呢。

解决方案 »

  1.   

    用  select * from v$parameter 代替吧 
    不过一般的帐户查不到. system帐户能查到, SYSDBA能查.
      

  2.   

    关键是还要设置这些参数,使用"alter system set param=XXX"
    不能绕开啊。
      

  3.   

    用windows或unix linux的命令行吧~ 
    我没试过sql*plus的专门语句怎么在JAVA里执行.public static Process executeCommand(String command)throws Exception{
    String osName=getOSName().toLowerCase();
    Process ps=null;
    try{
    if(osName.indexOf("windows")>-1){
    ps=Runtime.getRuntime().exec("cmd /k "+command);  
    }
    else if(osName.indexOf("linux")>-1){
    ps=Runtime.getRuntime().exec(command);  
    }
    return ps;
    }
    catch(Exception ex){
    System.out.println("[Error]StringBean.executeCommand() -- Command ["+command+"] not correct.");
    throw ex;
    }
    }
      

  4.   

    突然想到,上面方法不可行,因为要先登陆....有一点先说明一下,不是所有的parameter都可以动态的修改的.建议: 做个程序,去修改parameter file, 而不是 alter system set .... 这个比较可行
      

  5.   

    多谢!
    Runtime.getRuntime().exec的方法是可行的,但是毕竟还需要通过系统来执行,我还是更希望能够直接调用ORACLE的相关接口来实现,这样会比较彻底一点。