15-12. Loading Java Libraries Into the Database

Problem

You want to create a Java class that utilizes some external Java libraries. To do so, you must load those external libraries into the database.

Solution

Use the loadjava utility to store the external libraries into the database. In this example, a Java utility class containing a method that uses the JavaMail API to send e-mail will be loaded into the database. The method relies on some external Java libraries to use the JavaMail API. The following loadjava commands demonstrate the loading of three essential JAR files for using the JavaMail API:

loadjava –u <username> mail.jar loadjava –u <username> standard.jar loadjava –u <username> activation.jar

Next, load the Java source for the

Get Oracle and PL/SQL Recipes: A Problem-Solution Approach 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.