| 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
- Compiling and Assembling the Application
- Deploying the Sample Application
- Running the Sample Application
- Undeploying the Sample Application
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.
- JdbcRowSet - A JdbcRowSet object is basically an enhanced ResultSet object. It maintains a connection to its data source, just as a ResultSet object does. Unlike a ResultSet object, it has a set of properties and a listener notification mechanism that make it a JavaBeans component.
- CachedRowSet - A CachedRowSet object is unique because it can operate without being connected to its data source. It is a disconnected RowSet object.
- JoinRowSet - A JoinRowSet implementation lets you create an SQL JOIN between RowSet objects when they are not connected to a data source.
- FilteredRowSet - A FilteredRowSet object lets you reduce the number of rows that are visible in a RowSet object so that you can work with only relevant data.
- WebRowSet - A WebRowSet object is unique because in addition to offering all of the capabilities of a CachedRowSet object, it can both write itself as an XML document and read that XML document to convert back to a WebRowSet object.
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:
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.
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.
- 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.
- 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.
Deploy the application.
After you have created the sample application from scratch, you can proceed to Deploying the Sample Application.(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: If you want to verify registration of the application, proceed to Verifying Deployment. Otherwise, proceed to Running the Sample Application.
To verify the registration and deployment of the application, complete the following steps:
- Change to the source directory at install_root/samples/java/webapps/jdbc/rowset/src.
Run the ant tool using the list_apps task.
The jdbc-rowset module is listed as one of the components.
# ant list_apps
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:
Copyright © 2007 Sun Microsystems, Inc. All rights reserved.