Sun Java System Application Server 

Samples Index

Using Oracle with the Samples

The sample applications included in the Application Server are configured to work with the included Derby database server. For more information on using Derby with the samples see Using Derby with the Samples.

This document explains how to configure the samples environment to work with an Oracle database server.

Configuration and Set Up

Follow these steps to configure your environment to run sample applications with Oracle.

Configure Application Server with Oracle Type 4 JDBC Driver

To add the Oracle JDBC driver to the application server classpath, do one of the following:

You must restart the application server to update the classpath.

If you are using a Type 2 driver, you must also 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: 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.

Start sqlplus and login as system/manager. Then type this command:

<SQL>
@cr_ora_user.sql user_name password tablespace_name 

For Java Petstore, use one of the following as both user_name and password:

For tablespace_name, if you want to create a separate tablespace for all samples, use the install_dir/samples/docs/cr_ora_tb.sql script. If you don't want to create the new tablespace, issue the following SQL command as system/manager to see the available online tablespaces:

select tablespace_name, status from DBA_TABLESPACES

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 Derby.

Modify the Database Properties File

Edit the file install_dir/samples/database.properties

  • Set the default.database property to the type of JDBC driver you are using. Determine acceptable values by scanning the database.properties file. An entry of the type ABC.host or ABC.port implies that you can set default.database to ABC.
  • Ensure that the values for ABC.host, ABC.port and ABC.dbname (sid of the database) are set correctly.

Build and Deploy the Application

If the application has been deployed previously with a Derby configuration, use these commands to build and deploy it:

asant undeploy
asant deploy 

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

If this is the first time the application has been deployed, use these commands:

asant core
asant deploy




Copyright © 2006 Sun Microsystems, Inc. All rights reserved.