12c中导入java的jar文件

1、创建表空间
[oracle@host01 /]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Dec 21 15:29:33 2017
Copyright (c) 1982, 2014, Oracle.  All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> alter session set container=xfpdb;
SQL> create tablespace xftbs datafile '/u01/app/oracle/oradata/PRODCDB/xfpdb/xftbs01.dbf' size 10m;
Tablespace created.
2、创建用户并授权
SQL> create user xf identified by xf default tablespace xftbs quota unlimited on xftbs;
User created.

SQL> grant connect ,resource to xf;
Grant succeeded.

3、使用xf用户连接数据库执行jar包导入
需要将commons-math3-3.0.jar文件上传至/home/oracle/files/下
使用dbms_java.loadjava导入jar包
[oracle@host01 admin]$ sqlplus xf/xf@192.168.56.101:1521/xfpdb.example.com

SQL*Plus: Release 12.1.0.2.0 Production on Tue Dec 19 13:58:13 2017

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> call dbms_java.loadjava('-v -r PUBLIC -sysnonym /home/oracle/files/commons-math3-3.0.jar');

Call completed.

SQL> begin
      dbms_java.loadjava('-v -r PUBLIC -sysnonym /home/oracle/files/commons-math3-3.0.jar');
     end;
    /

PL/SQL procedure successfully completed.

SQL> exec dbms_java.loadjava('-v -r PUBLIC -sysnonym /home/oracle/files/commons-math3-3.0.jar');

PL/SQL procedure successfully completed.

或者使用loadjava命令
[oracle@host01 admin]$ loadjava -force -thin -user xf/xf@192.168.56.101:1521/xfpdb.example.com -resolve /home/oracle/files/commons-math3-3.0.jar

4在Oracle数据库创建java代码

SQL> create or replace and compile java source named jar_norm as
  2  import org.apache.commons.math3.distribution.NormalDistribution;
  3  public class jar_norm {
  4     public static double s_inv(double s){
  5     NormalDistribution normalDistribution =new NormalDistribution(0,1);
  6     double S1=normalDistribution.inverseCumulativeProbability(s);
  7     return S1;
  8     }
  9     public static double s_dist_c(double s){
 10     NormalDistribution normalDistribution =new NormalDistribution(0,1);
 11     double S1=normalDistribution.cumulativeProbability(s);
 12     return S1;
 13     }
 14  }
 15  /

Java created.

-end-

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28373936/viewspace-2149028/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/28373936/viewspace-2149028/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值