Skip Headers

Oracle® Database Java Developer's Guide
10g Release 1 (10.1)

Part Number B12021-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

4
Java Installation and Configuration

This chapter describes what you need to know to install and configure OracleJVM within your database. To configure Java memory, see the "Java Memory Usage" section in Chapter 10, "Oracle Database Java Application Performance".

Initializing a Java-Enabled Database

If you install Oracle Database with the OracleJVM option, the database is Java-enabled. That is, it is ready to run Java stored procedures and JDBC.

Oracle Database Template Configuration and Install

Configure the OracleJVM option within the database template. This is the recommended method for Java installation.

The Database Configuration Assistant allows you to create database templates for defining what each database instance installation will contain. Choose the OracleJVM option to have the Java platform installed within your database. See the Database Configuration Assistant documentation for more information on template creation.

Modifying an Existing Oracle Database to Include OracleJVM

If you have already installed your Oracle Database without OracleJVM, you can add Java to your database through the modify mode of the Oracle Database 10g Configuration Assistant. The modify mode enables you to choose the features, such as OracleJVM, that you would like installed on top of an existing Oracle Database.

Configuring OracleJVM

When you install OracleJVM as part of your normal Oracle Database installation, you will encounter configuration requirements for OracleJVM within the Oracle Database 10g Configuration Assistant and the Oracle Net Assistant.

The main configuration for Java classes within Oracle Database includes configuring Java memory requirements and the type of database processes.

Using The DBMS_JAVA Package

Installing OracleJVM creates the PL/SQL package DBMS_JAVA. Some entry points of DBMS_JAVA are for your use; others are only for internal use. The corresponding Java class DbmsJava provides methods for accessing RDBMS functionality from Java.

See "DBMS_JAVA Package" for complete information.

Enabling the Java Client

To run Java between the client and server, your client system must perform the following:

1. Install J2SE on the Client.

2. Set up Environment Variables.

3. Test Install with Samples.

1. Install J2SE on the Client

The client requires JDK 1.2.1 or later. To confirm what version of the JDK you are using, perform the following:

$ which java
/usr/local/j2se1.4.1/bin/java 
$ which javac 
/usr/local/j2se1.4.1/bin/javac 
$ java -version
java version "1.4.1"

2. Set up Environment Variables

After installing the JDK on your client, you must add the directory path to the following environment variables:


Note:

For NT users, the syntax for the environment variables is %ORACLE_HOME%, %JAVA_HOME%, %PATH%, and %LIB%.


JAR Files Necessary for Java 2 Clients

For a Java 2 client to communicate with the Java 2 server, you must make sure that one of the following JVM JAR files are in the CLASSPATH:

For any interaction with JDBC, include the following ZIP file:

$ORACLE_HOME/jdbc/lib/classes12.zip

For any client that uses SSL, include the following JAR files:

$ORACLE_HOME/jlib/jssl-1_2.jar 
$ORACLE_HOME/jlib/javax-ssl-1_2.jar 

For any client that uses Java Transaction API (JTA) functionality, include the following JAR file:

$ORACLE_HOME/jlib/jta.jar

For any client that uses JNDI functionality, include the following JAR file:

$ORACLE_HOME/jlib/jndi.jar

If you are using the Accelerator for native compilation, include $JAVA_HOME/lib/tools.jar

Server Application Development on the Client

If you develop and compile your server applications on the client and you want to use the same JAR files that are loaded on the server, include $ORACLE_HOME/lib/aurora.zip in the CLASSPATH. This is not required for running Java clients.

3. Test Install with Samples

We provide a set of samples in the $ORACLE_HOME/javavm/demo directory. These samples compile and run for a database installed with the OracleJVM option. Execute these samples as a test of your installation.

$ORACLE_HOME/javavm/demo/examples/jsproc/helloworld

If these samples do not compile or run, your environment is incorrect. Similarly, if these samples compile and run, but your code does not, then a problem exists within your build environment or code.


Note:

It is important that you run these examples using the supplied Makefiles (or batch files on NT) when verifying your installation.


Verify that the samples work before using more complex build environments, such as Visual Cafe, JDeveloper, or VisualAge.