Go to main content
1/93
Contents
List of Tables
Title and Copyright Information
Preface
Audience
Documentation Accessibility
Related Documents
Conventions
Changes in This Release for Oracle Database Java Developer's Guide
Changes in Oracle Database 12
c
Release 2 (12.2.0.1)
New Features
Desupported Features
1
Introduction to Java in Oracle Database
1.1
Overview of Java
1.1.1
Java and Object-Oriented Programming Terminology
1.1.1.1
Classes
1.1.1.2
Objects
1.1.1.3
Inheritance
1.1.1.4
Interfaces
1.1.1.5
Encapsulation
1.1.1.6
Polymorphism
1.1.2
Key Features of the Java Language
1.1.3
Java Virtual Machine
1.1.4
Java Class Hierarchy
1.2
About Using Java in Oracle Database
1.2.1
Java and RDBMS: A Robust Combination
1.2.2
About Multithreading
1.2.3
Memory Spaces Management
1.2.4
Footprint
1.2.5
Performance of an Oracle JVM
1.2.6
Dynamic Class Loading
1.3
Overview of Oracle JVM
1.3.1
Process Area
1.3.2
Java session initialization, duration and entrypoints
1.3.3
The GUI
1.3.4
The IDE
1.4
Feature List of Oracle JVM
1.5
Main Components of Oracle JVM
1.5.1
Library Manager
1.5.2
Compiler
1.5.3
Interpreter
1.5.4
Class Loader
1.5.5
Verifier
1.5.6
Server-Side JDBC Internal Driver
1.5.7
Server-Side SQLJ Translator
1.5.8
System Classes
1.6
Java Programming in Oracle Database
1.6.1
Java in Database Application Development
1.6.2
Java Programming Environment Usage
1.6.3
Java Stored Procedures
1.6.4
PL/SQL Integration and Oracle RDBMS Functionality
1.6.4.1
JDBC Drivers
1.6.4.2
SQLJ
1.6.5
Development Tools
1.6.6
Internet Protocol Version 6 Support
1.7
Support for Java 8
1.8
Introduction to Nashorn JavaScript Engine
1.8.1
About Using Nashorn JavaScript Engine
1.8.1.1
Loading JavaScript Code into a Schema
1.8.1.2
How to run JavaScript in Oracle JVM
1.8.1.2.1
Using the DBMS_JAVASCRIPT.RUN PL/SQL Procedure
1.8.1.2.2
Using the DbmsJavaScript Java Class
1.8.1.2.3
Using the Standard javax.script Java Package
1.8.2
JavaScript Data Access using JDBC
1.8.3
REST Enable Your JavaScript Application
1.9
Memory Model for Dedicated Mode Sessions
2
Java Applications on Oracle Database
2.1
Database Sessions Imposed on Java Applications
2.2
Execution Control of Java Applications
2.3
Java Code, Binaries, and Resources Storage
2.4
About Java Classes Loaded in the Database
2.5
Preparing Java Class Methods for Execution
2.5.1
Compiling Java Classes
2.5.1.1
Compiling Source Through javac
2.5.1.2
Compiling Source Through the loadjava Tool
2.5.1.3
Compiling Source at Run Time
2.5.1.4
Specifying Compiler Options
2.5.1.4.1
Specifying Default Compiler Options
2.5.1.4.2
Specifying Compiler Options on the Command Line
2.5.1.4.3
Specifying Compiler Options Specified in a Database Table
2.5.1.4.4
Details About Specifying Compiler Options Specified in the Database Table
2.5.1.5
Recompiling Source Programs Automatically
2.5.2
Overview of Resolving Class Dependencies
2.5.2.1
Allowing References to Nonexistent Classes
2.5.2.2
Bytecode Verifier
2.5.3
Logging in Oracle JVM
2.5.4
Overview of Loading Classes Using the loadjava Tool
2.5.4.1
About Sharing of Metadata for User Classloaded Classes
2.5.4.2
Defining the Same Class Twice
2.5.4.3
About Designating Database Privileges and JVM Permissions
2.5.4.4
About Loading JAR or ZIP Files
2.5.4.5
Database Resident JARs
2.5.5
Overview of Granting Execute Rights
2.5.6
Overview of Controlling the Current User
2.5.7
Overview of Checking Java Uploads
2.5.8
About Publishing Java Methods Loaded in the Database
2.5.9
Overview of Auditing Java Classes Loaded in the Database
2.6
User Interfaces on the Server
2.7
Shortened Class Names
2.8
Class.forName() in Oracle Database
2.8.1
Supply ClassLoader in Class.forName()
2.8.2
Supply Class and Schema Names to classForNameAndSchema()
2.8.3
Supply Class and Schema Names to lookupClass()
2.8.4
Supply Class and Schema Names when Serializing
2.8.5
Class.forName Example
2.9
About Managing Your Operating System Resources
2.9.1
Overview of Operating System Resources
2.9.2
Garbage Collection and Operating System Resources
2.10
About Using the Runtime.exec Functionality in Oracle Database
2.11
Managing Your Applications Using JMX
2.11.1
Overview of JMX
2.11.2
Enabling and Starting JMX in a Session
2.11.3
Setting Oracle JVM JMX Defaults and Configurability
2.11.4
Examples of SQL calls to dbms_java.start_jmx_agent
2.11.5
Using JConsole to Monitor and Control Oracle JVM
2.11.5.1
Using the jconsole Command
2.11.5.2
About Using the JConsole interface
2.11.5.3
About Viewing Oracle JVM Summary Information
2.11.5.4
About Monitoring Memory Consumption
2.11.5.5
About Monitoring Thread Use
2.11.5.6
About Monitoring Class Loading
2.11.5.7
About Monitoring and Managing MBeans
2.11.5.8
About Viewing VM Information
2.11.5.9
The OracleRuntime MBean
2.11.5.10
Memory Thresholds
2.11.6
Important Security Notes
2.11.7
Shared Server Limitations for JMX
2.12
Overview of Threading in Oracle Database
2.12.1
Thread Life Cycle
2.12.2
System.exit(), OracleRuntime.exitSession(), and OracleRuntime.exitCall()
2.13
Shared Servers Considerations
2.13.1
End-of-Call Migration
2.13.2
Oracle-Specific Support for End-of-Call Optimization
2.13.3
The EndOfCallRegistry.registerCallback() Method
2.13.4
The EndOfCallRegistry.runCallbacks() Method
2.13.5
The Callback Interface
2.13.6
The Callback.act() method
2.13.7
Operating System Resources Affected Across Calls
3
Calling Java Methods in Oracle Database
3.1
Invoking Java Methods
3.1.1
Using PL/SQL Wrappers
3.1.2
About JNI Support
3.1.3
About Utilizing SQLJ and JDBC with Java in the Database
3.1.3.1
Using JDBC
3.1.3.2
Using SQLJ
3.1.3.3
Example Comparing JDBC and SQLJ
3.1.3.4
SQLJ Strong Typing Paradigm
3.1.3.5
Translating a SQLJ Program
3.1.3.6
Interaction with PL/SQL
3.1.4
About Using the Command-Line Interface
3.1.5
Overview of Using the Client-Side Stub
3.1.5.1
Using the Default Service Feature
3.1.5.2
Testing the Default Service with a Basic Configuration
3.2
How To Tell Whether You Are Running on the Server
3.3
About Redirecting Output on the Server
4
Java Installation and Configuration
4.1
Initializing a Java-Enabled Database
4.1.1
Configuring the Oracle JVM Option within the Oracle Database Template
4.1.2
Modifying an Existing Oracle Database to Include Oracle JVM
4.2
Configuring Oracle JVM
4.3
The DBMS_JAVA Package
4.4
Enabling the Java Client
4.4.1
Installing Java SE on the Client
4.4.2
Setting Up Environment Variables
4.5
Two-Tier Duration for Java Session State
4.6
About Setting System Properties
5
Developing Java Stored Procedures
5.1
Stored Procedures and Run-Time Contexts
5.1.1
Functions and Procedures
5.1.2
Database Triggers
5.1.3
Object-Relational Methods
5.2
Advantages of Stored Procedures
5.2.1
Performance
5.2.2
Productivity and Ease of Use
5.2.3
Scalability
5.2.4
Maintainability
5.2.5
Interoperability
5.2.6
Replication
5.2.7
Security
5.3
Running Java Stored Procedures
5.3.1
Creating or Reusing the Java Classes
5.3.2
Loading and Resolving the Java Classes
5.3.3
Publishing the Java Classes
5.3.4
Calling the Stored Procedures
5.4
Debugging Java Stored Procedures
5.4.1
Prerequisites for Debugging Java Stored Procedures
5.4.2
Debugging Java Stored Procedures Using the jdb Debugger
5.4.3
Debugging Java Stored Procedures Using JDeveloper
6
Publishing Java Classes With Call Specifications
6.1
What Are Call Specifications?
6.2
Defining Call Specifications
6.2.1
About Setting Parameter Modes
6.2.2
About Mapping Data Types
6.2.3
Using the Server-Side Internal JDBC Driver
6.3
Writing Top-Level Call Specifications
6.3.1
Examples
6.4
Writing Packaged Call Specifications
6.5
Writing Object Type Call Specifications
6.5.1
About Attributes
6.5.2
Declaring Methods
6.5.2.1
Map and Order Methods
6.5.2.2
Constructor Methods
6.5.2.3
Examples
7
Calling Stored Procedures
7.1
Calling Java from the Top Level
7.1.1
Redirecting the Output
7.1.2
Examples of Calling Java Stored Procedures From the Top Level
7.2
Calling Java from Database Triggers
7.3
Calling Java from SQL DML
7.4
Calling Java from PL/SQL
7.5
Calling PL/SQL from Java
7.6
How Oracle JVM Handles Exceptions
8
Java Stored Procedures Application Example
8.1
About Planning the Database Schema
8.2
Creating the Database Tables
8.3
Writing the Java Classes
8.4
Loading the Java Classes
8.5
Publishing the Java Classes
8.6
Calling the Java Stored Procedures
9
Oracle Database Java Application Performance
9.1
Oracle JVM Just-in-Time Compiler (JIT)
9.1.1
Overview of Oracle JVM JIT
9.1.2
Advantages of JIT Compilation
9.1.3
Methods Introduced in Oracle Database 11g
9.2
About Java Memory Usage
9.2.1
Configuring Memory Initialization Parameters
9.2.1.1
Initializing Pool Sizes within Database Templates
9.2.2
About Java Pool Memory
9.2.3
Displaying Used Amounts of Java Pool Memory
9.2.4
Correcting Out of Memory Errors
9.2.5
Displaying Java Call and Session Heap Statistics
10
Security for Oracle Database Java Applications
10.1
Network Connection Security
10.2
Database Contents and Oracle JVM Security
10.2.1
Overview of Java 2 Security Features
10.2.2
Overview of Setting Permissions
10.2.2.1
Fine-Grain Definition for Each Permission
10.2.2.1.1
Granting and Limiting Permissions
10.2.2.1.2
Acquiring Administrative Permission to Update Policy Table
10.2.2.1.3
Creating Permissions
10.2.2.1.4
Enabling or Disabling Permissions
10.2.2.1.5
About Permission Types
10.2.2.1.6
About Initial Permission Grants
10.2.2.2
Assigning General Permission Definition to Roles
10.2.3
Debugging Permissions
10.2.4
Permission for Loading Classes
10.2.5
Customizing the Default java.security Resource
10.3
Database Authentication Mechanisms Available with Oracle JVM
10.4
Secure Use of Runtime.exec Functionality in Oracle Database
11
Native Oracle JVM Support for JNDI
11.1
Overview of Oracle JVM Support for JNDI
11.2
Requirements for Oracle JVM Support for JNDI
11.2.1
Namespace
11.2.1.1
Object permissions
11.2.1.2
Persistent Storage Tables, Indexes, and Sequences
11.2.1.3
Initial Contexts and Permissions
11.2.1.4
Object and Context Default Permissions
11.2.2
Oracle Java Directory Service JNDI Name Space Provider
11.2.2.1
Directory Context
11.2.2.2
StateFactories
11.2.2.3
ObjectFactories
11.2.2.4
OJDS URL Support
11.2.2.5
Client classpath
11.2.3
Namespace Browser
11.3
OJDS Command-Line Tools
11.3.1
ls Command
11.3.2
cd Command
11.3.3
pwd Command
11.3.4
chown Command
11.3.5
mkdir Command
11.3.6
rm Command
11.3.7
ln Command
11.3.8
mv Command
11.3.9
chmod Command
11.3.10
bind Command
11.3.11
bindds Command
11.3.12
bindurl Command
11.4
OJDS APIs and Classes
11.4.1
oracle.aurora.jndi.ojds.OjdsClientContext
11.4.2
oracle.aurora.jndi.ojds.OjdsServerContext
11.4.3
oracle.aurora.jndi.ojds.OjdsInitialContextFactory
11.4.4
oracle.aurora.jndi.ojds.OjdsURLContextFactory
11.4.5
oracle.aurora.jndi.ojds.OjdsURLContext
12
Schema Objects and Oracle JVM Utilities
12.1
Overview of Schema Objects
12.2
What and When to Load
12.3
Resolution of Schema Objects
12.4
Compilation of Schema Objects
12.5
The ojvmtc Tool
12.5.1
About the ojvmtc Tool
12.5.2
Arguments of ojvmtc Command
12.6
The loadjava Tool
12.6.1
loadjava Tool Syntax
12.6.2
loadjava Tool Argument Summary
12.6.3
loadjava Tool Argument Details
12.7
The dropjava Tool
12.7.1
dropjava Tool Syntax
12.7.2
dropjava Tool Argument Summary
12.7.3
dropjava Tool Argument Details
12.7.4
About Dropping Resources Using dropjava Tool
12.8
The ojvmjava Tool
12.8.1
ojvmjava Tool Syntax
12.8.2
ojvmjava Tool Argument Summary
12.8.3
ojvmjava Tool Example
12.8.4
ojvmjava Tool Functionality
12.8.4.1
ojvmjava Tool Command-Line Options
12.8.4.2
ojvmjava Tool Shell Commands
13
Database Web Services
13.1
Overview of Database Web Services
13.2
About Using Oracle Database as Web Services Consumer
13.2.1
About Using Oracle JVM Web Services Call-Out Utility
13.2.1.1
Architecture of Oracle JVM Web Services Call-Out Utility
13.2.1.2
Input to Oracle JVM Web Services Call-Out Utility
13.2.1.3
Output of the Oracle JVM Web Services Call-Out Utility
13.2.1.4
Calling Secure Web Service from Oracle JVM Web Services Call-Out Utility
13.2.2
Web Service Data Sources (Virtual Table Support)
13.2.3
Features of Oracle Database as a Web Service Consumer
A
DBMS_JAVA Package
A.1
longname
A.2
shortname
A.3
get_compiler_option
A.4
set_compiler_option
A.5
reset_compiler_option
A.6
resolver
A.7
derivedFrom
A.8
fixed_in_instance
A.9
set_output
A.10
export_source
A.11
export_class
A.12
export_resource
A.13
loadjava
A.14
dropjava
A.15
grant_permission
A.16
grant_permission
A.17
restrict_permission
A.18
restrict_permission
A.19
grant_policy_permission
A.20
grant_policy_permission
A.21
revoke_permission
A.22
disable_permission
A.23
enable_permission
A.24
delete_permission
A.25
set_preference
A.26
runjava
A.27
runjava_in_current_session
A.28
set_property
A.29
get_property
A.30
remove_property
A.31
show_property
A.32
set_output_to_sql
A.33
remove_output_to_sql
A.34
enable_output_to_sql
A.35
disable_output_to_sql
A.36
query_output_to_sql
A.37
set_output_to_java
A.38
remove_output_to_java
A.39
enable_output_to_java
A.40
disable_output_to_java
A.41
query_output_to_java
A.42
set_output_to_file
A.43
remove_output_to_file
A.44
enable_output_to_file
A.45
disable_output_to_file
A.46
query_output_to_file
A.47
enable_output_to_trc
A.48
disable_output_to_trc
A.49
query_output_to_trc
A.50
endsession
A.51
endsession_and_related_state
A.52
set_native_compiler_option
A.53
unset_native_compiler_option
A.54
compile_class
A.55
uncompile_class
A.56
compile_method
A.57
uncompile_method
A.58
start_jmx_agent
A.59
set_runtime_exec_credentials
B
Classpath Extensions and User Classloaded Metadata
B.1
Classpath Extensions
B.1.1
jserverQuotedClassPathTermPrefix
B.1.2
jserverURLPrefix
B.1.3
jserverSpecialTokenPrefix
B.1.4
JSERVER_CP
B.1.5
JSERVER_SCHEMAc
B.1.6
jserver:/CP general syntax
B.2
User Classloaded Metadata
Index
Scripting on this page enhances content navigation, but does not change the content in any way.