JDBC Rowset Sample Application

JDBC Rowset Sample Application


This document describes how to use the Java DataBase Connectivity (JDBC) Rowset sample application with Sun Java System Web Server.

This document contains the following sections:


Overview

This sample application demonstrates the JDBC rowset feature.

A JDBC RowSet object holds tabular data in a way that makes it more flexible and easier to use than a result set.
The five versions of the RowSet interface and their implementations are included.

Setting Up the Environment

For information about creating and maintaining the database, refer to the database documentation.

For information about using the PointBase database with Sun Java System Web Server, refer to How to Run Sample Applications With PointBase.

For information about using the Oracle database with Sun Java System Web Server, refer to How to Run Sample Applications With Oracle.

Note - Make sure that the necessary parameters for running the samples are specified in install_root/samples/java/webapps/common.properties.

Compiling and Assembling the Application



To compile and assemble the sample application, complete the following steps:
  1. If you want to run the sample on an Oracle or a PointBase database, you must use the following script to create the tables inventory and order_item: install_root/samples/java/webapps/jdbc/rowset/src/sql/database.sql

    See How to Run Sample Applications With PointBase or How to Run Sample Applications With Oracle.

  2. JDBC datasource can be created with the Administration GUI or CLI, or with the following method. Make sure that the necessary parameters for creating the JDBC resource are specified in the jdbc.build.properties file under the install_root/samples/java/webapps/jdbc directory. If you created the JDBC datasource using the Administration GUI or CLI, make sure that you added the JDBC driver jar files into the class-path-suffix element.

  3. Compile and assemble the WAR file by changing to the source directory at install_root/samples/java/webapps/jdbc/rowset/src and running the ant command.

    The default target default is executed to build the WAR file.

  4. This creates the jdbc-resource element. Based on the jar files specified in the class.path.suffix property, the jar files will be added to the class-path-suffix element. For information about using the Administration GUI or CLI to create the data source, refer to Deploying Samples and Creating the Resources using Admin GUI.

    Note - If you want to delete the data source, execute ant delete_resource.

  5. Deploy the application.

    After you have created the sample application from scratch, you can proceed to Deploying the Sample Application.

  6. (Optional.) Clean the web application project area.

    # ant clean

    This removes the assemble and build directories for the sample application. The WAR file is now ready for deployment.


Deploying the Sample Application

To deploy the sample application, complete the following steps:
  1. Change to the source directory at install_root/samples/java/webapps/jdbc/rowset/src.

  2. Run the ant tool using the deploy task.

    # ant deploy

If you want to verify registration of the application, proceed to Verifying Deployment. Otherwise, proceed to Running the Sample Application.
 

Verifying Deployment

To verify the registration and deployment of the application, complete the following steps:

  1. Change to the source directory at install_root/samples/java/webapps/jdbc/rowset/src.
  2. Run the ant tool using the list_apps task.

    # ant list_apps

    The jdbc-rowset module is listed as one of the components.
     

Running the Sample Application


You can run the application through the following URL:

http://Sun_Java_System_Web_Server_hostname:port/jdbc-rowset


Undeploying the Sample Application

After successfully deploying and running the application, you might decide to undeploy it and remove the files. To undeploy the application, complete the following steps:

  1. Change to the source directory at install_root/samples/java/webapps/jdbc/rowset/src.

  2. Run the ant tool using the undeploy task.

    # ant undeploy

  3. Run the ant tool using the delete_resource task.

    # ant delete_resource

     
    This removes the deployed resource.


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