1/23
Contents
List of Examples
List of Figures
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 1 (12.1)
1
Introduction to Java in Oracle Database
Overview of Java
Java and Object-Oriented Programming Terminology
Classes
Objects
Inheritance
Interfaces
Encapsulation
Polymorphism
Key Features of the Java Language
Java Virtual Machine
Java Class Hierarchy
Using Java in Oracle Database
Java and RDBMS: A Robust Combination
Multithreading
Memory Spaces Management
Footprint
Performance of an Oracle JVM
Dynamic Class Loading
Overview of Oracle JVM
Process Area
Java session initialization, duration and entrypoints
The GUI
The IDE
Feature List of Oracle JVM
Main Components of Oracle JVM
Library Manager
Compiler
Interpreter
Class Loader
Verifier
Server-Side JDBC Internal Driver
Server-Side SQLJ Translator
System Classes
Java Application Strategy of Oracle
Java in Database Application Development
Java Programming Environment
Java Stored Procedures
PL/SQL Integration and Oracle RDBMS Functionality
JDBC Drivers
SQLJ
JPublisher
Development Tools
Internet Protocol Version 6 Support
Multiple JDK Support
Without an Existing Database
With an Existing Database
Memory Model for Dedicated Mode Sessions
2
Java Applications on Oracle Database
Database Sessions Imposed on Java Applications
Execution Control of Java Applications
Java Code, Binaries, and Resources Storage
Preparing Java Class Methods for Execution
Compiling Java Classes
Compiling Source Through javac
Compiling Source Through the loadjava Tool
Compiling Source at Run Time
Specifying Compiler Options
Recompiling Automatically
Resolving Class Dependencies
Logging in Oracle JVM
Loading Classes
Granting Execute Rights
Controlling the Current User
Checking Java Uploads
Publishing
Auditing
User Interfaces on the Server
Shortened Class Names
Class.forName() in Oracle Database
Supply ClassLoader in Class.forName()
Supply Class and Schema Names to classForNameAndSchema()
Supply Class and Schema Names to lookupClass()
Supply Class and Schema Names when Serializing
Class.forName Example
Managing Your Operating System Resources
Overview of Operating System Resources
Garbage Collection and Operating System Resources
Using the Runtime.exec Functionality in Oracle Database
Managing Your Applications Using JMX
Overview of JMX
Enabling and Starting JMX in a Session
Oracle JVM JMX Defaults and Configurability
Examples of SQL calls to dbms_java.start_jmx_agent
Using JConsole to Monitor and Control Oracle JVM
The jconsole Command
The JConsole interface
The OracleRuntime MBean
Memory Thresholds
Important Security Notes
Shared Server Limitations for JMX
Threading in Oracle Database
Shared Servers Considerations
End-of-Call Migration
Oracle-Specific Support for End-of-Call Optimization
The EndOfCallRegistry.registerCallback() Method
The EndOfCallRegistry.runCallbacks() Method
The Callback Interface
The Callback.act() method
Operating System Resources Affected Across Calls
3
Calling Java Methods in Oracle Database
Invoking Java Methods
Using PL/SQL Wrappers
JNI Support
Utilizing SQLJ and JDBC with Java in the Database
JDBC
SQLJ
Example Comparing JDBC and SQLJ
Complete SQLJ Example
SQLJ Strong Typing Paradigm
Translating a SQLJ Program
Running a SQLJ Program in the Server
Converting a Client Application to Run on the Server
Interacting with PL/SQL
Using Command-Line Interface
Using the Client-Side Stub
How To Tell You Are Running on the Server
Redirecting Output on the Server
Calling Java in the Database Directly
4
Java Installation and Configuration
Initializing a Java-Enabled Database
Configuring with Oracle Database Template
Modifying an Existing Oracle Database to Include Oracle JVM
Configuring Oracle JVM
Using The DBMS_JAVA Package
Enabling the Java Client
Install Java SE on the Client
Set Up Environment Variables
Test Install with Samples
Two-Tier Duration for Java Session State
Setting System Properties
5
Developing Java Stored Procedures
Stored Procedures and Run-Time Contexts
Functions and Procedures
Database Triggers
Object-Relational Methods
Advantages of Stored Procedures
Performance
Productivity and Ease of Use
Scalability
Maintainability
Interoperability
Replication
Security
Java Stored Procedures Steps
Step 1: Create or Reuse the Java Classes
Step 2: Load and Resolve the Java Classes
Step 3: Publish the Java Classes
Step 4: Call the Stored Procedures
Debugging Java Stored Procedures
Prerequisites for Debugging Java Stored Procedures
Debugging Java Stored Procedures Using the jdb Debugger
Debugging Java stored procedure using JDeveloper
6
Publishing Java Classes With Call Specifications
Understanding Call Specifications
Defining Call Specifications
Setting Parameter Modes
Mapping Data Types
Using the Server-Side Internal JDBC Driver
Writing Top-Level Call Specifications
Writing Packaged Call Specifications
Writing Object Type Call Specifications
Declaring Attributes
Declaring Methods
Map and Order Methods
Constructor Methods
Examples
7
Calling Stored Procedures
Calling Java from the Top Level
Redirecting Output
Examples of Calling Java Stored Procedures From the Top Level
Calling Java from Database Triggers
Calling Java from SQL DML
Calling Java from PL/SQL
Calling PL/SQL from Java
How Oracle JVM Handles Exceptions
8
Java Stored Procedures Application Example
Planning the Database Schema
Creating the Database Tables
Writing the Java Classes
Loading the Java Classes
Publishing the Java Classes
Calling the Java Stored Procedures
9
Oracle Database Java Application Performance
Oracle JVM Just-in-Time Compiler (JIT)
Overview of Oracle JVM JIT
Advantages of JIT Compilation
Methods Introduced in Oracle Database 11g
Java Memory Usage
Configuring Memory Initialization Parameters
Initializing Pool Sizes within Database Templates
Java Pool Memory
Displaying Used Amounts of Java Pool Memory
Correcting Out of Memory Errors
Displaying Java Call and Session Heap Statistics
10
Security for Oracle Database Java Applications
Network Connection Security
Database Contents and Oracle JVM Security
Java 2 Security
Setting Permissions
Fine-Grain Definition for Each Permission
General Permission Definition Assigned to Roles
Debugging Permissions
Permission for Loading Classes
Customizing Default java.security Resource
Database Authentication Mechanisms
Secure Use of Runtime.exec Functionality in Oracle Database
11
Native Oracle JVM Support for JNDI
Overview of Oracle JVM Support for JNDI
Requirements for Oracle JVM Support for JNDI
Namespace
Object permissions
Persistent Storage Tables, Indexes, and Sequences
Initial Contexts and Permissions
Object and Context Default Permissions
Oracle Java Directory Service JNDI Name Space Provider
Directory Context
StateFactories
ObjectFactories
OJDS URL Support
Client classpath
Namespace Browser
OJDS Command-Line Tools
ls Command
cd Command
pwd Command
chown Command
mkdir Command
rm Command
ln Command
mv Command
chmod Command
bind Command
bindds Command
bindurl Command
OJDS APIs and Classes
oracle.aurora.jndi.ojds.OjdsClientContext
oracle.aurora.jndi.ojds.OjdsServerContext
oracle.aurora.jndi.ojds.OjdsInitialContextFactory
oracle.aurora.jndi.ojds.OjdsURLContextFactory
oracle.aurora.jndi.ojds.OjdsURLContext
12
Schema Objects and Oracle JVM Utilities
Overview of Schema Objects
What and When to Load
Resolution of Schema Objects
Compilation of Schema Objects
The ojvmtc Tool
The loadjava Tool
Syntax
Argument Summary
Argument Details
The dropjava Tool
Syntax
Argument Summary
Argument Details
Dropping Resources
The ojvmjava Tool
Syntax
Argument Summary
Example
Functionality
ojvmjava Tool Command-Line Options
Shell Commands
13
Database Web Services
Overview of Database Web Services
Using Oracle Database as Web Services Provider
How to Use JPublisher for Web Services Call-Ins
Features of Oracle Database as a Web Service Provider
JPublisher Support for Web Services Call-Ins to Oracle Database
Using Oracle Database as Web Services Consumer
How to Use Oracle Database for Web Services Call-Outs
Web Service Data Sources (Virtual Table Support)
Features of Oracle Database as a Web Service Consumer
Overview of JPublisher Generation
Adjusting the Mapping of SQL Types
A
DBMS_JAVA Package
longname
shortname
get_compiler_option
set_compiler_option
reset_compiler_option
resolver
derivedFrom
fixed_in_instance
set_output
export_source
export_class
export_resource
loadjava
dropjava
grant_permission
grant_permission
restrict_permission
restrict_permission
grant_policy_permission
grant_policy_permission
revoke_permission
disable_permission
enable_permission
delete_permission
set_preference
runjava
runjava_in_current_session
set_property
get_property
remove_property
show_property
set_output_to_sql
remove_output_to_sql
enable_output_to_sql
disable_output_to_sql
query_output_to_sql
set_output_to_java
remove_output_to_java
enable_output_to_java
disable_output_to_java
query_output_to_java
set_output_to_file
remove_output_to_file
enable_output_to_file
disable_output_to_file
query_output_to_file
enable_output_to_trc
disable_output_to_trc
query_output_to_trc
endsession
endsession_and_related_state
set_native_compiler_option
unset_native_compiler_option
compile_class
uncompile_class
compile_method
uncompile_method
start_jmx_agent
set_runtime_exec_credentials
B
Classpath Extensions and User Classloaded Metadata
Classpath Extensions
jserverQuotedClassPathTermPrefix
jserverURLPrefix
jserverSpecialTokenPrefix
JSERVER_CP
JSERVER_SCHEMAc
jserver:/CP general syntax
User Classloaded Metadata
Index
Scripting on this page enhances content navigation, but does not change the content in any way.