Oracle calls Java code

Source: Internet
Author: User

The main contents include: Java Development, Package Java program into jar file, upload jar file to Oracle system, Oracle import JAR file in Java class to database, Oracle create function according to import Java class, Oracle operation function.

Software used: Oracle database, Oracle database installed on Linux operating system; Java is developed with idea; uploading jar files with WINSCP; operating Oracle database with PL/SQL;

  Java class authoring rules for 1.Oracle operations

Oracle supports different JDK versions, Oracle8 supports JDK1.2,ORACLE9 support JDK1.3,ORACLE10 support JDK1.4,ORACLE11 support JDK1.5

Use this chapter to manipulate Java methods only support static methods, non-static methods are not available

2.IDEA changing the compilation JDK version method

When idea opens, choose File-project Structure

 

When idea opens, select File-settings

 3.IDEA Dozen Jar Bags

  Open idea and choose File-project Structure

Open idea

4. Upload the jar package

Open WinSCP, upload the jar file to the Temptest folder in the root directory

  5.Oracle Database Operations Jar Package

Enter your Oracle account password and select Connect as Sysdba

Post-Login interface

Select File-New command line

Import jar to Oracle command:

Call Dbms_java.loadjava ('-v-r public-synonym/temptest/oracle-code.jar ');

Prompt error, query reason is imported jar package not all classes are imported successfully, some classes may fail to import. However, most classes are imported successfully. I have tested that importing all the classes succeeds or will report this error.

Query the imported class command:

Select *  from where object_type='JAVA CLASS'andobject_name  like '%com%'andTIMESTAMP>'  2017-12-21:16:22:42';

6.Oracle creating functions from imported Java code

  Run Command :

Test the Created function

To run a function operation on a field in an Oracle table

Oracle calls Java code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.