這篇文章主要介紹oracle12c中如何導(dǎo)入java的jar文件,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!
為立山等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及立山網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為成都網(wǎng)站設(shè)計、做網(wǎng)站、成都外貿(mào)網(wǎng)站建設(shè)公司、立山網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!
1、創(chuàng)建表空間
[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、創(chuàng)建用戶并授權(quán)
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用戶連接數(shù)據(jù)庫執(zhí)行jar包導(dǎo)入
需要將commons-math4-3.0.jar文件上傳至/home/oracle/files/下
使用dbms_java.loadjava導(dǎo)入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-math4-3.0.jar');
Call completed.
SQL> begin
dbms_java.loadjava('-v -r PUBLIC -sysnonym /home/oracle/files/commons-math4-3.0.jar');
end;
/
PL/SQL procedure successfully completed.
SQL> exec dbms_java.loadjava('-v -r PUBLIC -sysnonym /home/oracle/files/commons-math4-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-math4-3.0.jar
4、在Oracle數(shù)據(jù)庫創(chuàng)建java代碼
SQL> create or replace and compile java source named jar_norm as
2 import org.apache.commons.math4.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 /
以上是“oracle12c中如何導(dǎo)入java的jar文件”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!