Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to import jar file of java in oracle12c

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to import the jar file of java in oracle12c, which is very detailed and has certain reference value. Friends who are interested must finish reading it!

1. Create a tablespace

[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 size 10m

Tablespace created.

2. Create a user and authorize it

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. Use xf users to connect to the database to perform jar package import

Need to upload the commons-math4-3.0.jar file to / home/oracle/files/

Import jar packages using dbms_java.loadjava

[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.

Or use the loadjava command

[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. Create java code in Oracle database

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 (0jue 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 (0jue 1)

11 double S1=normalDistribution.cumulativeProbability (s)

12 return S1

13}

14}

15 /

The above is all the contents of the article "how to import java's jar file in oracle12c". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report