Sun Microsystems Logo

 

 

Sun Java System Web Server Samples
Using Oracle With the Samples

This document contain instructions on how to configure the Oracle JDBC driver with the Sun Java System Web Server. The samples included with the web server contain instructions for configuring them to work with an Oracle database. You can use jdbc-simple as a template to configure Oracle to work with other applications. For database-related information, see the Oracle documentation.

To learn about basic operations with Oracle and the Sun Java System Web Server, read the following sections:

  » Configuration and Set Up Instructions
  » Registering JDBC Resources and Defining Connection Pools
  » Troubleshooting and Notes

Configuration and Set Up Instructions

Configure Sun Java System Web Server With Oracle Type 4 JDBC Driver

Add the Oracle JDBC driver to the web server classpath by completing the following steps.

  1. Log on to the Administration GUI.
  2. Click the Configurations tab.
  3. Select the correct configuration.
  4. Click the Java tab.
  5. Click the Path Settings tab.
  6. Append the Oracle jdbc jar path to Classpath Suffix field.
    If you are using a Type 2 driver, you must also add oracle_home_directory_path/lib to the Native Library Path Prefix field.
  7. Click Save.
  8. Click Deploy.

Create the Database Users and Schemas for the Sample Application

To complete the following procedure, you should have access to a running Oracle RDBMS.

Note - The user creation script will drop any existing users with the same name.

Use install_root/samples/java/docs/cr_ora_user.sql to create a specific sample Oracle user. This script creates the user on the specified tablespace.

For example, using system/manager for the sqlplus login:

<SQL> @cr_ora_user.sql user_name password tablespace_name


    NOTE - tablespace_name
    If you want to create a separate tablespace for all samples,use the install_root/samples/java/docs/cr_ora_tb.sql script. If you don't want to create the new tablespace, use the sql command select tablespace_name, status from DBA_TABLESPACES to see the available online tablespaces (run this sql command as system/manager). 

You can use sqlplus to execute SQL statements found in the .sql files within the src/sql directory of each JDBC-relevant sample.

Note - If only one .sql file exists in the src/sql directory, it will work with both Oracle and PointBase.

The following procedure describes how to configure the jdbc-simple sample to work with Oracle:
  1. Use sqplus and log in as system/manager to create Oracle user jdbc/jdbc on the specified tablespace.
    <SQL> @cr_ora_user.sql jdbc tablespace_name

  2. Load the schema for the jdbc-simple application as the user jdbc by using the script jdbc-simple-ora.sql located in install_root/samples/java/webapps/jdbc/simple/src/sql.
    <SQL> @jdbc-simple-ora.sql

  3. Run the application (refer to the jdbc simple sample).
In the same way, you can use the same user jdbc for all of the samples, or you can create a different user for every sample.

Registering JDBC Resources and Defining Connection Pools

You can reveiw the sample common.xml and build.xml files to learn how to use ant to define JDBC resources and connection pools. Also, refer to the following:

Troubleshooting and Notes

JDBC/Blob Sample:  If the Type 4 JDBC driver is used as described in this document, the uploaded file cannot exceed 5 KB. The workaround is to use the Type 2 OCI driver. Here are the steps to set up the driver:

1. In the administrative console, modify the property for connection pool jdbc-blobPool. The value of the url property should be jdbc:oracle:oci8@db_alias (db_alias should be defined in TNS).

2. Add the oracle driver path to classpathsuffix (Refer to "Configure Sun Java System Web Server with Oracle Type 4 JDBC Driver" section).

3. Deploy the configuration.