How Do You Create a WebRowSet Object? JDBC

Before you can create a RowSet object, you need to provide implementation classes for the RowSet interface, or you may use the reference implementations provided by Sun. To use Sun’s reference implementations, you need to download the reference implementations of RowSet and include the rowset.jar file in your CLASSPATH environment variable. Sun’s reference implementation provides the com.sun.rowset.WebRowSetImpl class, which implements the WebRowSet interface (the standard implementation of the WebRowSet interface).

MySQL Database Setup

Create a WebRowSet Object

To create a WebRowSet object, we use the WebRowSetExample class, which does the following:

  • Create a WebRowSet object:
  • webRS = new WebRowSetImpl();
  • Set the SQL query for getting the result from the database:
  • webRS.setCommand(sqlQuery);
  • Pass the Connection object to the execute() method to fill up the WebRowSet object:
  • webRS.execute(conn);

Running the Solution for a MySQL Database

According to The metadata section of the XML document describing a WebRowSet object contains information about the columns in that WebRowSet object.” The following XML output shows what this section looks like for the WebRowSet object webRS. Because webRS has two columns, the XML document describing it has two <column-definition> elements. Each <column-definition> element has subelements giving information about the column being described.

A WebRowSet object in XML has three sections: Properties, Metadata, and Data. Here, for readability purposes, I have partitioned output of the program into Properties, Metadata, and Data:

he Properties section (<properties> shown here) contains information about our connection, including our SQL command associated to our WebRowSet:

The Metadata section (<metadata> shown here) contains metadata about the structure of the columns that our WebRowSet object consists of:



Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

JDBC Topics