Chapter 22. Calling Java from PL/SQL

In this chapter, I explore an exciting feature introduced in Oracle8i that allows a developer to call Java stored procedures ( JSPs) from within PL/SQL. Java is a very powerful language, more robust in many ways than PL/SQL. Java also offers hundreds of classes that provide clean, easy-to-use Application Programming Interfaces (APIs) to a wide variety of functionality.

Oracle and Java

Beginning with the Oracle8i release, Oracle includes a product called JServer, which consists of the following elements:

  • Oracle’s Java Virtual Machine ( JVM), called Aurora; the supporting runtime environment; and Java class libraries

  • Tight integration with PL/SQL and Oracle RDBMS functionality

  • An Object Request Broker (the Aurora/ORB) and Enterprise JavaBeans (EJB)

  • The JServer Accelerator (native compiler)

The Aurora JVM executes Java methods (also known as Java stored procedures, or JSPs) and classes if they were stored in the database itself.

Java in the Oracle database is a big topic; Java programming all by itself is an even bigger topic. Complete treatment of either is outside the scope of this book. My objectives for this chapter are limited to the following:

  • Providing the information you need to load Java classes into the Oracle database, manage those new database objects, and publish them for use inside PL/SQL

  • Offering a basic tutorial in building Java classes that will provide enough guidance to let you construct simple classes to access underlying ...

Get Oracle PL/SQL Programming, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.