Java Reference
In-Depth Information
Caution
Since requesting an
UpdatableResultSet
does not guarantee that you will
actually get one, depending on the driver in use, you should check whether the
ResultSet
is updatable using
ResultSet.getConcurrency()
.
Note that setter methods are shown for the properties in the HTML form. If you don't include a setter
method for each form property, Tomcat will give you a "method not found" error message.
Notice that I leave in a couple of
System.out.println()
statements. Before assuming that the
update works correctly, it is important to ensure that you actually have an updatable
ResultSet
.
Drivers that do not support updatable
ResultSets
go through the motions, but they return a
READ_ONLY ResultSet
.
Cross-
Reference
Chapter 4
discusses the uses of updatable
ResultSets
at greater length,
although the examples are not as detailed as the JavaBean example given
here.
Summary
In this chapter, you learned how to combine ResultSets, Java Server Pages, and XML and XSL to
create database-driven Web pages. Specifically, you learned the following:
Using scrollable ResultSets to search a Web site
Creating an XML document from a ResultSet
Applying XSL stylesheets to create different Web pages from a single XML document
Using an updatable ResultSet with an HTML form to update a database record
Chapter 16
explains how to use the JavaMail API with JDBC to send e-mail from a database and to
receive and store e-mail to a database.