Sun Microsystems Logo



Using Oracle with the Samples

The sample applications included in the Application Server are configured to work with the bundled PointBase Network Server 4.5. More information on using PointBase with the samples can be found in the Using PointBase with the Samples document. The purpose of this document is to outline the steps needed to configure the samples environment to work with an Oracle RDBMS.

This document contains instructions to configure the Oracle JDBC driver, an example using the petstore sample application to demonstrate steps involved in using Oracle instead of Pointbase and a list of samples that contain Oracle-specific instructions. The samples included in this list contain specific instructions for configuring the sample to work with an Oracle RDBMS.

To learn about basic operations with Oracle and the Application Server, read the following sections:


» Configuration and Set Up Instructions

» Samples with Oracle instructions

Configuration and Set Up Instructions

Configure Application Server with Oracle Type 4 JDBC Driver

You can add the Oracle JDBC driver to the application server classpath by either:

  • Copying the driver library to the application server instance's lib/ directory which is <install_dir>/domains/domain1/lib. All the libraries in this directory are automatically added to the server's classpath during restart. Or,
  • Adding the driver's path to the Classpath Suffix setting under the application server instance's Application Server -> JVM Settings Tab -> Path Settings page in the administrative console.

In both cases, the application server must be restarted to update the classpath.

If you are using a Type 2 driver, you will also need to add <oracle_home>/lib to the Native Library Path Suffix setting in the application server instance's Application Server -> JVM Settings Tab -> Path Settings page.

Create the Database Users and Schemas for the Sample Application

The following steps assume that you have access to a running Oracle RDBMS. Note that the user creation script will drop any existing users with the same name.

Use <install_dir>/samples/docs/cr_ora_user.sql to create specific sample oracle user. This script will create the user on the specified tablespace.

Using sqlplus, login as system/manager:

<SQL> @cr_ora_user.sql user_name password tablespace_name

    user_name:
    The following username and password are consistent with the naming convention used for PointBase.

    Sample User Password
    Java Pet Store petstore petstore
    opc opc
    supplier supplier


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

Use sqlplus with the user created above and run the SQL script under <sample_app_dir>/sql to load the database schema for this sample.

When there is only one .sql file, it works with both Oracle and PointBase.

Modify <install_dir>/samples/database.properties file
  1. Set the default.database property to the type of JDBC driver you are using. Acceptable values can be seen by scanning the database.properties. An entry of the type ABC.host or ABC.port implies that default.database can be set to ABC.
  2. Ensure that the values for ABC.host, ABC.port and ABC.dbname (sid of the database) are set correctly.
Compile and Deploy the Application

If the application has been deployed previously with a PointBase configuration:

asant undeploy
asant deploy

You need to restart the application server if the application ran previously with Pointbase.

If this is the first time the application has been deployed:

asant core
asant deploy

Samples with Oracle Instructions

The following applications contain the necessary sql files and ant targets (build.xml) to work with Oracle. Refer to the sample documentation for Oracle specific instructions.

» Java Pet Store