A RowSet (javax.sql.RowSet) object contains a set of rows from a result set (ResultSet) or some other source of tabular data, like a file or spreadsheet. Because a RowSet object follows the JavaBeans model for properties and event notification, it is a JavaBeans component that can be combined with other components in an application. As is true with other Beans, application programmers will probably use a development tool to create a RowSet object and set its properties. Rowsets may have many different implementations to fill different needs. These implementations fall into two broad categories, rowsets that are connected and those that are disconnected. A disconnected rowset gets a connection to a data source in order to fill itself with data or to propagate changes in data back to the data source, but most of the time it does not have a connection open. While it is disconnected, it does not need a JDBC driver or the full JDBC API, so its footprint is very small. Thus a rowset is an ideal format for sending data over a network to a thin client.
RowSetMetaData(defined in the javax.sql package) is an object that contains information about the columns in a RowSet object. This interface is an extension of the ResultSetMetaData interface with methods for setting the values in a RowSetMetaData object. When a RowSetReader object reads data into a RowSet object, it creates a RowSetMetaData object and initializes it using the methods in the RowSetMetaData interface. Then the reader passes the RowSetMetaData object to the rowset.
A RowSetMetaData object’s format is not suitable for web-based applications. For this reason, I will provide a Java servlet to display that object in an XML object; a client may extract the desired information from that XML object. Disconnected RowSet objects (such as CachedRowSet and WebRowSet) provide an XML format for their data metadata, and I will take advantage of such methods. Note that one of the main reasons to use a CachedRowSet or WebRowSet object is to pass data between different components of an application. Because it is serializable, a CachedRowSet or WebRowSet object can be used, for example, to send the result of a query executed by an enterprise JavaBeans component running in a server environment over a network to a client running in a web browser.
What follows is a Java servlet, GetRowSetMetaData, which will display SQL queries metadata as an XML object. The signature of GetRowSetMetaData isGetRowSetMetaData?vendor=<database-vendor>&query=<SQL-Query>
You may modify and update this servlet to pass additional dynamic parameters to your SQL queries.
MySQL Database Setup
Oracle Database Setup
Invoking GetRowSetMetaData for MySQL
Figure : shows how to run the solution for the MySQL database.
Invoking GetRowSetMetaData for Oracle
Figure : shows how to run the solution for the Oracle database.
JDBC Related Interview Questions
|Core Java Interview Questions||JSP Interview Questions|
|Java Servlets Interview Questions||EJB(Enterprise JavaBeans) Interview Questions|
|JSTL(JSP Standard Tag Library) Interview Questions||JNDI (Java Naming and Directory Interface) Interview Questions|
|Java Bean Utils Interview Questions||AWT (Abstract Window Toolkit) Interview Questions|
What Is Jdbc Programming?
Database Metadata, Part 1
Database Metadata, Part 2
Exploring Driver Property Information
Rowset Metadata A
Web Access To Metadata,part 1
Web Access To Metadata, Part 2
Rdf And Jdbc Metadata
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.