blob: 80f960cbc31070e3ff0bc3cb2d00fdafbae8d5a6 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
2<html>
3<head>
4
5 <meta http-equiv="Content-Type"
6 content="text/html; charset=iso-8859-1">
7<!--
8Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
9DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10
11This code is free software; you can redistribute it and/or modify it
12under the terms of the GNU General Public License version 2 only, as
13published by the Free Software Foundation. Sun designates this
14particular file as subject to the "Classpath" exception as provided
15by Sun in the LICENSE file that accompanied this code.
16
17This code is distributed in the hope that it will be useful, but WITHOUT
18ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20version 2 for more details (a copy is included in the LICENSE file that
21accompanied this code).
22
23You should have received a copy of the GNU General Public License version
242 along with this work; if not, write to the Free Software Foundation,
25Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26
27Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
28CA 95054 USA or visit www.sun.com if you need additional information or
29have any questions.
30
31-->
32 <title>javax.sql.rowset Package</title>
33</head>
34 <body bgcolor="#ffffff">
35
36<!-- Description clause -->
37Standard interfaces and base classes for JDBC <code>RowSet</code>
38implementations. This package contains interfaces and classes
39that a standard <code>RowSet</code> implementation either implements or extends.
40
41
42<h2>Table of Contents</h2>
43<ul>
44<li><a href="#pkgspec">1.0 Package Specification</a>
45<li><a href="#stdrowset">2.0 Standard RowSet Definitions</a>
46<li><a href="#impl">3.0 Implementater's Guide</a>
47<li><a href="#relspec">4.0 Related Specifications</a>
48<li><a href="#reldocs">5.0 Related Documentation</a>
49</ul>
50
51<h3><a name="pkgspec">1.0 Package Specification</a></h3>
52This package specifies five standard JDBC <code>RowSet</code> interfaces.
53 All five extend the
54<a href="../RowSet.html">RowSet</a> interface described in the JDBC 3.0
55specification. It is anticipated that additional definitions
56of more specialized JDBC <code>RowSet</code> types will emerge as this technology
57matures. Future definitions <i>should</i> be specified as subinterfaces using
58inheritance similar to the way it is used in this specification.
59<p>
60<i>Note:</i> The interface definitions provided in this package form the basis for
61all compliant JDBC <code>RowSet</code> implementations. Vendors and more advanced
62developers who intend to provide their own compliant <code>RowSet</code> implementations
63should pay particular attention to the assertions detailed in specification
64interfaces.
65
66<h3><a name="stdrowset">2.0 Standard RowSet Definitions</a></h3>
67<ul>
68<li><a href="JdbcRowSet.html"><b><code>JdbcRowSet</code></b></a> - A wrapper around
69a <tt>ResultSet</tt> object that makes it possible to use the result set as a
70JavaBeans<sup><font size=-2>TM</font></sup> component. Thus,
71a <tt>JdbcRowSet</tt> object can be a Bean that any tool
72makes available for assembling an application as part of a component based
73architecture . A <tt>JdbcRowSet</tt> object is a connected <code>RowSet</code>
74object, that is, it
75<b>must</b> continually maintain its connection to its data source using a JDBC
76technology-enabled driver ("JDBC driver"). In addition, a <code>JdbcRowSet</code>
77object provides a fully updatable and scrollable tabular
78data structure as defined in the JDBC 3.0 specification.
79<p>
80<li><a href="CachedRowSet.html">
81<b><code>CachedRowSet</code><sup><font size=-2>TM></font></sup</b></a>
82 - A <tt>CachedRowSet</tt> object is a JavaBeans<sup><font size=-2>TM</font></sup>
83 component that is scrollable, updatable, serializable, and generally disconnected from
84 the source of its data. A <tt>CachedRowSet</tt> object
85typically contains rows from a result set, but it can also contain rows from any
86file with a tabular format, such as a spreadsheet. <tt>CachedRowSet</tt> implementations
87<b>must</b> use the <tt>SyncFactory</tt> to manage and obtain pluggable
88<code>SyncProvider</code> objects to provide synchronization between the
89disconnected <code>RowSet</code> object and the originating data source.
90Typically a <code>SyncProvider</code> implementation relies upon a JDBC
91driver to obtain connectivity to a particular data source.
92Further details on this mechanism are discussed in the <a
93href="spi/package-summary.html"><code>javax.sql.rowset.spi</code></a> package
94specification.
95<p>
96<li><a href="WebRowSet.html"><b><code>WebRowSet</code></b></a> - A
97<code>WebRowSet</code> object is an extension of <tt>CachedRowSet</tt>
98that can read and write a <code>RowSet</code> object in a well formed XML format.
99This class calls an <a href="spi/XmlReader.html"><code>XmlReader</code></a> object
100(an extension of the <a href="../RowSetReader.html"><code>RowSetReader</code></a>
101interface) to read a rowset in XML format. It calls an
102<a href="spi/XmlWriter.html"><code>XmlWriter</code></a> object (an extension of the
103<a href="../RowSetWriter.html"><code>RowSetWriter</code></a> interface)
104to write a rowset in XML format. The reader and writer required by
105<code>WebRowSet</code> objects are provided by the
106<code>SyncFactory</code> in the form of <code>SyncProvider</code>
107implementations. In order to ensure well formed XML usage, a standard generic XML
108Schema is defined and published at
109<a href="http://java.sun.com/xml/ns/jdbc/webrowset.xsd">
110<code>http://java.sun.com/xml/ns/jdbc/webrowset.xsd</code></a>.
111<p>
112<li><a href="FilteredRowSet.html"><b><code>FilteredRowSet</code></b></a> - A
113<tt>FilteredRowSet</tt> object provides filtering functionality in a programmatic
114and extensible way. There are many instances when a <tt>RowSet</tt> <code>object</code>
115has a need to provide filtering in its contents without sacrificing the disconnected
116environment, thus saving the expense of having to create a connection to the data source.
117Solutions to this need vary from providing heavyweight full scale
118SQL query abilities, to portable components, to more lightweight
119approaches. A <code>FilteredRowSet</code> object consumes
120an implementation of the <a href="Predicate.html"><code>Predicate</code></a>
121interface, which <b>may</b> define a filter at run time. In turn, a
122<code>FilteredRowSet</code> object is tasked with enforcing the set filter for both
123inbound and outbound read and write operations. That is, all filters can be
124considered as bi-directional. No standard filters are defined;
125however, sufficient mechanics are specified to permit any required filter to be
126implemented.
127<p>
128<li><a href="JoinRowSet.html"><b><code>JoinRowSet</code></b></a> - The <tt>JoinRowSet</tt>
129interface describes a mechanism by which relationships can be established between
130two or more standard <code>RowSet</code> implementations. Any number of <tt>RowSet</tt>
131 objects can be added to a <tt>JoinRowSet</tt> object provided the <tt>RowSet</tt>objects
132can be related in a SQL <tt>JOIN</tt> like fashion. By definition, the SQL <tt>JOIN</tt>
133statement is used to combine the data contained in two (<i>or more</i>) relational
134database tables based upon a common attribute. By establishing and then enforcing
135column matches, a <tt>JoinRowSet</tt> object establishes relationships between
136<tt>RowSet</tt> instances without the need to touch the originating data source.
137</ul>
138
139<h3><a name="impl">3.0 Implementer's Guide</a></h3>
140Compliant implementations of JDBC <code>RowSet</code> Implementations
141<b>must</b> follow the assertions described in this specification. In accordance
142with the terms of the <a href="http://www.jcp.org">Java Community Process</a>, a
143Test Compatibility Kit (TCK) can be licensed to ensure compatibility with the
144specification. The following paragraphs outline a number of starting points for
145implementers of the standard JDBC <code>RowSet</code> definitions. Implementers
146should also consult the <i>Implementer's Guide</i> in the <a
147href="spi/package-summary.html">javax.sql.rowset.spi</a> package for guidelines
148on <a href="spi/SyncProvider.html"><code>SyncProvider</code></a> implementations.
149<p>
150<ul>
151<li><b>3.1 Role of the <code>BaseRowSet</code> Class</b>
152<p>
153A compliant JDBC <code>RowSet</code> implementation <b>must</b> implement one or more
154standard interfaces specified in this package and and <b>may</b> extend the
155<a href="BaseRowSet.html"><code>BaseRowSet</code></a> abstract class. For example, a
156<code>CachedRowSet</code> implementation must implement the <code>CachedRowSet</code>
157interface and extend the <code>BaseRowSet</code> abstract class. The
158<code>BaseRowSet</code> class provides the standard architecture on which all
159<code>RowSet</code> implementations should be built, regardless of whether the
160<code>RowSet</code> objects exist in a connected or disconnected environment.
161The <tt>BaseRowSet</tt> abstract class provides any <tt>RowSet</tt> implementation
162with its base functionality, including property manipulation and event notification
163that is fully compliant with <a href="http://java.sun.com/products/javabeans">JavaBeans</a>
164component requirements. As an example, all implementations provided in the
165reference implementations (contained in the <tt>com.sun.rowset</tt> package) use
166the <tt>BaseRowSet</tt> class as a basis for their implementations.
167<P>
168The following table illustrates the features that the <code>BaseRowSet</code>
169abstract class provides.
170 <blockquote>
171 <table cellpadding="2" cellspacing="2" border="1" width="75%">
172 <tbody>
173 <tr>
174 <td valign="top"><b>Feature</b><br>
175 </td>
176 <td valign="top"><b>Details</b><br>
177 </td>
178 </tr>
179 <tr>
180 <td valign="top">Properties<br>
181 </td>
182 <td valign="top">Provides standard JavaBeans property manipulation
183 mechanisms to allow applications to get and set <code>RowSet</code> command and
184property values. Refer to the documentation of the <tt>javax.sql.RowSet</tt>
185interface (available in the JDBC 3.0 specification) for more details on
186the standard <code>RowSet</code> properties.<br>
187 </td>
188 </tr>
189 <tr>
190 <td valign="top">Event notification<br>
191 </td>
192 <td valign="top">Provides standard JavaBeans event notifications
193 to registered event listeners. Refer to the documentation of <tt>javax.sql.RowSetEvent
194 </tt> interface (available in the JDBC 3.0 specification) for
195more details on how to register and handle standard RowSet events generated
196by compliant implementations.<br>
197 </td>
198 </tr>
199 <tr>
200 <td valign="top">Setters for a RowSet object's command<br>
201 </td>
202 <td valign="top">Provides a complete set of setter methods
203 for setting RowSet command parameters.<br>
204 </td>
205 </tr>
206 <tr>
207 <td valign="top">Streams<br>
208 </td>
209 <td valign="top">Provides fields for storing of stream instances
210 in addition to providing a set of constants for stream type designation.<br>
211 </td>
212 </tr>
213
214 </tbody>
215 </table>
216 </blockquote>
217<p>
218<li><b>3.2 Connected RowSet Requirements</b>
219<p>
220The <code>JdbcRowSet</code> describes a <code>RowSet</code> object that <b>must</b> always
221be connected to the originating data source. Implementations of the <code>JdbcRowSet</code>
222should ensure that this connection is provided solely by a JDBC driver.
223Furthermore, <code>RowSet</code> objects that are implementations of the
224<code>JdbcRowSet</code> interface and are therefore operating in a connected environment
225do not use the <code>SyncFactory</code> to obtain a <code>RowSetReader</code> object
226or a <code>RowSetWriter</code> object. They can safely rely on the JDBC driver to
227supply their needs by virtue of the presence of an underlying updatable and scrollable
228<code>ResultSet</code> implementation.
229<p>
230
231<li>
232<b>3.3 Disconnected RowSet Requirements</b>
233<p>
234A disconnected <code>RowSet</code> object, such as a <code>CachedRowSet</code> object,
235<b>should</b> delegate
236connection management to a <code>SyncProvider</code> object provided by the
237<code>SyncFactory</code>. To ensure fully disconnected semantics, all
238disconnected <code>RowSet</code> objects <b>must</b> ensure
239that the original connection made to the data source to populate the <code>RowSet</code>
240object is closed to permit the garbage collector to recover and release resources. The
241<code>SyncProvider</code> object ensures that the critical JDBC properties are
242maintained in order to re-establish a connection to the data source when a
243synchronization is required. A disconnected <code>RowSet</code> object should
244therefore ensure that no
245extraneous references remain on the <code>Connection</code> object.
246<p>
247<li><b>3.4 Role of RowSetMetaDataImpl</b>
248<p>
249The <code>RowsetMetaDataImpl</code> class is a utility class that provides an implementation of the
250<a href="../RowSetMetaData.html">RowSetMetaData</a> interface, supplying standard setter
251method implementations for metadata for both connected and disconnected
252<code>RowSet</code> objects. All implementations are free to use this standard
253implementation but are not required to do so.
254<p>
255<li><b>3.5 RowSetWarning Class</b>
256<p>
257The <code>RowSetWarning</code> class provides warnings that can be set
258on <code>RowSet</code> implementations.
259Similar to <a href="../../../java/sql/SQLWarning.html">SQLWarning</a> objects,
260<code>RowSetWarning</code> objects are silently chained to the object whose method
261caused the warning to be thrown. All <code>RowSet</code> implementations <b>should</b>
262ensure that this chaining occurs if a warning is generated and also ensure that the
263warnings are available via the <code>getRowSetWarnings</code> method defined in either
264the <code>JdbcRowSet</code> interface or the <code>CachedRowSet</code> interface.
265After a warning has been retrieved with one of the
266<code>getRowSetWarnings</code> methods, the <code>RowSetWarning</code> method
267<code>getNextWarning</code> can be called on it to retrieve any warnings that might
268be chained on it. If a warning is returned, <code>getNextWarning</code> can be called
269on it, and so on until there are no more warnings.
270
271
272<P>
273<li><b>3.6 The Joinable Interface</b>
274<P>
275The <code>Joinable</code> interface provides both connected and disconnected
276<code>RowSet</code> objects with the capability to be added to a
277<code>JoinRowSet</code> object in an SQL <code>JOIN</code> operation.
278A <code>RowSet</code> object that has implemented the <code>Joinable</code>
279interface can set a match column, retrieve a match column, or unset a match column.
280A <code>JoinRowSet</code> object can then use the <code>RowSet</code> object's
281match column as a basis for adding the <code>RowSet</code> object.
282</ul>
283
284<h3><a name="relspec">4.0 Related Specifications</a></h3>
285<ul>
286<li><a href="http://java.sun.com/products/jdbc">JDBC 3.0 Specification</a>
287<li><a href="http://www.w3.org/XML/Schema">XML Schema</a>
288<li><a href="http://www.syncml.org">SyncML</a>
289</ul>
290
291<h3><a name="reldocs">5.0 Related Documentation</a></h3>
292<ul>
293<li><a href="http://developer.java.sun.com/developer/Books/JDBCTutorial/chapter5.html">
294JDBC RowSet Tutorial</a>
295</ul>
296</body>
297</html>