Oracle® Database Java Developer's Guide 10g Release 1 (10.1) Part Number B12021-02 |
|
|
View PDF |
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".
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, and SQLJ.
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.
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.
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.
Java memory requirements—You must have at least 20 MB of JAVA_POOL_SIZE
and 50 MB of SHARED_POOL_SIZE
. See "Java Memory Usage" for information on configuring these parameters.
Database processes—You must decide whether to use dedicated server processes or shared server processes for your database server.
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.
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.
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"
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%. |
$JAVA_HOME
—must be set to the top directory of the installed JDK base
$PATH
—requires $JAVA_HOME/bin
$LD_LIBRARY_PATH
for Solaris or %LIB%
for Windows NT—must include $JAVA_HOME/lib
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 JDK 1.2, include $JAVA_HOME/lib/dt.jar
For JRE 1.2, include $JAVA_HOME/lib/rt.jar
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
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.