Oracle Web RowSet - Part2

Exclusive offer: get 50% off this eBook here
JDBC 4.0 and Oracle JDeveloper for J2EE Development

JDBC 4.0 and Oracle JDeveloper for J2EE Development — Save 50%

A J2EE developer's guide to using Oracle JDeveloper's integrated database features to build data-driven applications with this book and eBook

$26.99    $13.50
by Deepak Vohra | April 2009 | Java Oracle

In this two-part article series by Deepak Vohra, we will use the XML document representation of a result set generated with an SQL query to modify a relational database table. In the first part we set the environment, create a Web RowSet, modify a database table with Web RowSet, and create a new row. In this article we will learn to read a row, update a row, delete a row, update the database table and also get acquainted with JDBC 4.0 Version.

Reading a Row

Next, we will read a row from the OracleWebRowSet object. Click on Modify Web RowSet link in the CreateRow.jsp. In the ModifyWebRowSet JSP click on the Read Row link. The ReadRow.jsp JSP is displayed. In the ReadRow JSP specify the Database Row to Read and click on Apply.

Oracle Web RowSet - Part2

The second row values are retrieved from the Web RowSet:

Oracle Web RowSet - Part2

In the ReadRow JSP the readRow() method of the WebRowSetQuery.java application is invoked. TheWebRowSetQuery object is retrieved from the session object.

WebRowSetQuery query=( webrowset.WebRowSetQuery)
session.getAttribute("query");

The String[] values returned by the readRow() method are added to theReadRow JSP fields. In the readRow() method theOracleWebRowSet object cursor is moved to the row to be read.

webRowSet.absolute(rowRead);

Retrieve the row values with the getString() method and add to String[]. Return the String[] object.

String[] resultSet=new String[5];
resultSet[0]=webRowSet.getString(1);
resultSet[1]=webRowSet.getString(2);
resultSet[2]=webRowSet.getString(3);
resultSet[3]=webRowSet.getString(4);
resultSet[4]=webRowSet.getString(5);
return resultSet;

ReadRow.jsp JSP is listed as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page session="true"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>Read Row with Web RowSet</title>
</head>
<body>
<form><h3>Read Row with Web RowSet</h3>
<table>
<tr>
<td><a href="ModifyWebRowSet.jsp">Modify Web RowSet
Page</a></td>
</tr>
</table>
</form>
<%
webrowset.WebRowSetQuery query=null;
query=( webrowset.WebRowSetQuery)
session.getAttribute("query");
String rowRead=request.getParameter("rowRead");
String journalUpdate=request.getParameter("journalUpdate");
String publisherUpdate=request.getParameter("publisherUpdate");
String editionUpdate=request.getParameter("editionUpdate");
String titleUpdate=request.getParameter("titleUpdate");
String authorUpdate=request.getParameter("authorUpdate");
if((rowRead!=null))
{
int row_Read=Integer.parseInt(rowRead);
String[] resultSet=query.readRow(row_Read);
journalUpdate=resultSet[0];
publisherUpdate=resultSet[1];
editionUpdate=resultSet[2];
titleUpdate=resultSet[3];
authorUpdate=resultSet[4];
}
%>
<form name="query" action="ReadRow.jsp" method="post">
<table>
<tr>
<td>Database Row to Read:</td>
</tr>
<tr>
<td>
<input name="rowRead" type="text" size="25"
maxlength="50"/>
</td>
</tr>
<tr>
<td>Journal:</td>
</tr>
<tr>
<td>
<input name="journalUpdate" value='<%=journalUpdate%>'
type="text" size="50" maxlength="250"/>
</td>
</tr>
<tr>
<td>Publisher:</td>
</tr>
<tr>
<td>
<input name="publisherUpdate"
value='<%=publisherUpdate%>' type="text" size="50"
maxlength="250"/>
</td>
</tr>
<tr>
<td>Edition:</td>
</tr>
<tr>
<td>
<input name="editionUpdate" value='<%=editionUpdate%>'
type="text" size="50" maxlength="250"/>
</td>
</tr>
<tr>
<td>Title:</td>
</tr>
<tr>
<td>
<input name="titleUpdate" value='<%=titleUpdate%>'
type="text" size="50" maxlength="250"/>
</td>
</tr>
<tr>
<td>Author:</td>
</tr>
<tr>
<td>
<input name="authorUpdate" value='<%=authorUpdate%>'
type="text" size="50" maxlength="250"/>
</td>
</tr><tr>
<td>
<input class="Submit" type="submit" value="Apply"/>
</td>
</tr>
</table>
</form>
</body>
</html>
JDBC 4.0 and Oracle JDeveloper for J2EE Development A J2EE developer's guide to using Oracle JDeveloper's integrated database features to build data-driven applications with this book and eBook
Published: April 2008
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:

Updating a Row

Next, we will update a row in the OracleWebRowSet object. Click on the Modify Web RowSet Page link in the ReadRow JSP. Click on the Update Row link in the ModifyWebRowSet JSP. Specify the row to be updated and specify the modified values in theUpdateRow JSP . For example, update the second row. Click on Apply.

Oracle Web RowSet - Part2

The UpdateRow JSP invokes the updateRow() method of theWebRowSetQuery Java class. The WebRowSetQuery object is retrieved from the session object:

WebRowSetQuery query=( webrowset.WebRowSetQuery)
session.getAttribute("query");

In the updateRow() method the OracleWebRowSet object cursor is moved to the row to be updated:

webRowSet.absolute(rowUpdate);

The row values are updated with the updateString() method of theOracleWebRowSet object:

webRowSet.updateString(1, journal);
webRowSet.updateString(2, publisher);
webRowSet.updateString(3, edition);
webRowSet.updateString(4, title);
webRowSet.updateString(5, author);

Update the OracleWebRowSet object with the updateRow() method:

webRowSet.updateRow();

The row in the OracleWebRowSet object is updated. The row in the database table is not updated yet. UpdateRow.jsp is listed as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page session="true"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>Update Row in Database Table with Web RowSet</title>
</head>
<body>
<form><h3>Update Row in Database Table with Web RowSet</h3>
<table>
<tr>
<td><a href="ModifyWebRowSet.jsp">Modify Web RowSet
Page</a></td>
</tr>
</table>
</form>
<%
webrowset.WebRowSetQuery query=null;
query=( webrowset.WebRowSetQuery)
session.getAttribute("query");
String rowUpdate=request.getParameter("rowUpdate");
String journalUpdate=request.getParameter("journalUpdate");
String publisherUpdate=request.getParameter("publisherUpdate");
String editionUpdate=request.getParameter("editionUpdate");
String titleUpdate=request.getParameter("titleUpdate");
String authorUpdate=request.getParameter("authorUpdate");
if((rowUpdate!=null))
{
System.out.println(rowUpdate +"Row to Update");
int row_Update=Integer.parseInt(rowUpdate);
query.updateRow(row_Update, journalUpdate, publisherUpdate,
editionUpdate, titleUpdate, authorUpdate);
}
%>
<form name="query" action="UpdateRow.jsp" method="post">
<table>
<tr>
<td>Database Row to Update:</td>
</tr>
<tr>
<td>
<input name="rowUpdate" type="text" size="25"
maxlength="50"/>
</td>
</tr>
<tr>
<td>Journal:</td>
</tr>
<tr>
<td>
<input name="journalUpdate" type="text" size="50"
maxlength="250"/>
</td>
</tr>
<tr>
<td>Publisher:</td>
</tr>
<tr>
<td>
<input name="publisherUpdate" type="text" size="50"
maxlength="250"/>
</td>
</tr>
<tr>
<td>Edition:</td>
</tr>
<tr>
<td>
<input name="editionUpdate" type="text" size="50"
maxlength="250"/>
</td>
</tr>
<tr>
<td>Title:</td>
</tr>
<tr>
<td>
<input name="titleUpdate" type="text" size="50"
maxlength="250"/>
</td>
</tr>
<tr>
<td>Author:</td>
</tr>
<tr>
<td>
<input name="authorUpdate" type="text" size="50"
maxlength="250"/>
</td>
</tr>
<tr>
<td>
<input class="Submit" type="submit" value="Apply"/>
</td>
</tr>
</table>
</form>
</body>
</html>

Deleting a Row

Next, we will delete a row from the OracleWebRowSet object. Click on the Modify Web RowSet link in the UpdateRow JSP. In the ModifyWebRowSet JSP click on the Delete Row link. In the Delete Row JSP specify the row to delete and click on Apply. For example, delete the third row.

Oracle Web RowSet - Part2

In the DeleteRow JSP the deleteRow() method of the WebRowSetQuery Java class is invoked. The WebRowSetQuery object is retrieved from the session object:

WebRowSetQuery query=( webrowset.WebRowSetQuery)
session.getAttribute("query");

In the deleteRow() method the OracleWebRowSetobject cursor is moved to the row to be deleted:

webRowSet.absolute(row);

Delete the row with the deleteRow() method of the OracleWebRowSet object. The create, update, and delete operations are performed on the OracleWebRowSet object, not on the database table. The DeleteRow.jsp is as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page session="true"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>Delete Database Table Row with Web RowSet</title>
</head>
<body>
<form><h3>Delete Database Table Row with Web RowSet</h3>
<table>
<tr>
<td><a href="ModifyWebRowSet.jsp">Modify Web RowSet
Page</a></td>
</tr>
</table>
</form>
<%
webrowset.WebRowSetQuery query=null;
query=(
webrowset.WebRowSetQuery)session.getAttribute("query");
String deleteRow=request.getParameter("deleteRow");
if((deleteRow!=null)){
int delete_Row=Integer.parseInt(deleteRow);
query.deleteRow(delete_Row);
}
%>
<form name="query" action="DeleteRow.jsp" method="post">
<table>
<tr>
<td><h4>Delete Row</h4></td>
</tr>
<tr>
<td>
<input name="deleteRow" type="text" size="25"
maxlength="50"/>
</td>
</tr>
<tr>
<td>
<input class="Submit" type="submit" value="Apply"/>
</td>
</tr>
</table>
</form>
</body>
</html>

Updating Database Table

Next, we will update the database table with the modified OracleWebRowSet object. Click on the Modify Web RowSet link in the DeleteRow JSP. Click on the Update Database link in theModifyWebRowSet JSP. Click on Apply in UpdateDatabase.jsp.

Oracle Web RowSet - Part2

In the UpdateDatabase.jsp, the WebRowSetQuery object is retrieved from the session object:

WebRowSetQuery query=(WebRowSet.WebRowSetQuery)
session.getAttribute("query");

If the WebRowSetQuery object is not null, invoke the updateDatabase() method of the WebRowSetQuery.java class. Also output the XML document which represents the modifications made to the Web RowSet:

if(query!=null){
query.updateDatabase();
query.generateXMLDocument();
}

In the updateDatabase() method the database table is updated using theacceptChanges() method:

webRowSet.acceptChanges();

The database table, Catalog, is updated with the modifications made in the OracleWebRowSet. The UpdateDatabase.jsp JSP is listed below:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page session="true"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>Update Database Table with Web RowSet</title>
</head>
<body>
<h3>Update Database Table with Web RowSet</h3>
<% webrowset.WebRowSetQuery query=null;%>
<%
String
updateDatabase=request.getParameter("updateDatabase");
if(updateDatabase!=null)
query
=( webrowset.WebRowSetQuery)session.getAttribute("query");
if(query!=null)
{
query.updateDatabase();
query.generateXMLDocument();}
%>
<form name="query" action="UpdateDatabase.jsp" method="post">
<input type="hidden" name="updateDatabase" value=
"Update Database"/>
<table>
<tr>
<td>Update Database
</td>
</tr>
<tr>
<td>
<input class="Submit" type="submit" value="Apply"/>
</td>
</tr>
</table>
</form>
</body>
</html>

The XML document corresponding to the OracleWebRowSet object after the modifications are made is listed below. The modified XML document, as compared to the XML document before modifications has a row added, a row modified, and a row deleted.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE RowSet PUBLIC '-//Sun Microsystems, Inc.//DTD RowSet//EN'
'http://java.sun.com/j2ee/dtds/RowSet.dtd'>
<RowSet>
<properties>
<command>SELECT JOURNAL, PUBLISHER, EDITION, TITLE, AUTHOR FROM
OE.Catalog</command>
<concurrency>1007</concurrency>
<datasource>jdbc/OracleDataSource</datasource>
<escape-processing>true</escape-processing>
<fetch-direction>1002</fetch-direction>
<fetch-size>10</fetch-size>
<isolation-level>2</isolation-level>
<key-columns>
</key-columns>
<map></map>
<max-field-size>0</max-field-size>
<max-rows>3</max-rows>
<query-timeout>0</query-timeout>
<read-only>false</read-only>
<rowset-type>1005</rowset-type>
<show-deleted>false</show-deleted>
<url>jdbc:oracle:thin:@localhost:1521:ORCL</url>
</properties>
<metadata>
<column-count>5</column-count>
<column-definition>
<column-index>1</column-index>
<auto-increment>false</auto-increment>
<case-sensitive>true</case-sensitive>
<currency>false</currency>
<nullable>1</nullable>
<signed>true</signed>
<searchable>true</searchable>
<column-display-size>25</column-display-size>
<column-label>JOURNAL</column-label>
<column-name>JOURNAL</column-name>
<schema-name></schema-name>
<column-precision>0</column-precision>
<column-scale>0</column-scale>
<table-name></table-name>
<catalog-name></catalog-name>
<column-type>12</column-type>
<column-type-name>VARCHAR2</column-type-name>
</column-definition>
<column-definition>
<column-index>2</column-index>
<auto-increment>false</auto-increment>
<case-sensitive>true</case-sensitive>
<currency>false</currency>
<nullable>1</nullable>
<signed>true</signed>
<searchable>true</searchable>
<column-display-size>25</column-display-size>
<column-label>PUBLISHER</column-label>
<column-name>PUBLISHER</column-name>
<schema-name></schema-name>
<column-precision>0</column-precision>
<column-scale>0</column-scale>
<table-name></table-name>
<catalog-name></catalog-name>
<column-type>12</column-type>
<column-type-name>VARCHAR2</column-type-name>
</column-definition>
<column-definition>
<column-index>3</column-index>
<auto-increment>false</auto-increment>
<case-sensitive>true</case-sensitive>
<currency>false</currency>
<nullable>1</nullable>
<signed>true</signed>
<searchable>true</searchable>
<column-display-size>25</column-display-size>
<column-label>EDITION</column-label>
<column-name>EDITION</column-name>
<schema-name></schema-name>
<column-precision>0</column-precision>
<column-scale>0</column-scale>
<table-name></table-name>
<catalog-name></catalog-name>
<column-type>12</column-type>
<column-type-name>VARCHAR2</column-type-name>
</column-definition>
<column-definition>
<column-index>4</column-index>
<auto-increment>false</auto-increment>
<case-sensitive>true</case-sensitive>
<currency>false</currency>
<nullable>1</nullable>
<signed>true</signed>
<searchable>true</searchable>
<column-display-size>45</column-display-size>
<column-label>TITLE</column-label>
<column-name>TITLE</column-name>
<schema-name></schema-name>
<column-precision>0</column-precision>
<column-scale>0</column-scale>
<table-name></table-name>
<catalog-name></catalog-name>
<column-type>12</column-type>
<column-type-name>VARCHAR2</column-type-name>
</column-definition>
<column-definition>
<column-index>5</column-index>
<auto-increment>false</auto-increment>
<case-sensitive>true</case-sensitive>
<currency>false</currency>
<nullable>1</nullable>
<signed>true</signed>
<searchable>true</searchable>
<column-display-size>25</column-display-size>
<column-label>AUTHOR</column-label>
<column-name>AUTHOR</column-name>
<schema-name></schema-name>
<column-precision>0</column-precision>
<column-scale>0</column-scale>
<table-name></table-name>
<catalog-name></catalog-name>
<column-type>12</column-type>
<column-type-name>VARCHAR2</column-type-name>
</column-definition>
</metadata>
<data>
<row>
<col>Oracle Magazine</col>
<col>Oracle Publishing</col>
<col>July-August 2005</col>
<col>Configuring Undo Tablespace</col>
<col>Floss, Kimberly</col>
</row>
<row>
<col>Oracle Magazine</col>
<col>Oracle Publishing</col>
<col>March-April 2004</col>
<col>Oracle Certified Master</col>
<col>Jim Dillani</col>
</row>
</data>
</RowSet>

Query the database table Catalog, the output produced. A new row has been added, a row modified, and a row deleted.

Oracle Web RowSet - Part2

In this section a Web RowSet was generated from a database table, the WebRowSet was modified, and the database table updated with the modified Web RowSet.

JDBC 4.0 and Oracle JDeveloper for J2EE Development A J2EE developer's guide to using Oracle JDeveloper's integrated database features to build data-driven applications with this book and eBook
Published: April 2008
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:

JDBC 4.0 Version

The OC4J embedded in JDeveloper 10g or JDeveloper 11g does not implement JDBC 4.0 specification. The new features in JDBC 4.0 may be availed of in a later version of JDeveloper that supports JDBC 4.0 specification.

In the JDBC 4.0 version of the web application, add the Oracle database 11g JDBC 4.0 drivers JAR file, ojdbc6.jar, to the j2ee/home/applib directory, which is in the runtime class path of a web applications running in OC4J server. Also add ojdbc6.jar to the project libraries by selecting Tools | Project Properties and subsequently selecting Libraries | Add Jar/Directory. For the JDBC 4.0 drivers we need to set the JDK version to JDK 6.0. Select the project node in Applications-Navigator and select Tools | Project Properties. Select the Libraries node in the Project Properties window and click on J2SE Version field's Change button to set the JDK version. In the Edit J2SE Definition window, click on New. In the Create J2SE window, select a JDK 6.0 J2SE Executable and click on OK.

Oracle Web RowSet - Part2

In the Edit J2SE Definition window, select the JDK 6.0 J2SE Definition and click OK.

Oracle Web RowSet - Part2

In the Project Properties window the J2SE Version gets set to JDK 6.0.

Oracle Web RowSet - Part2

JDBC 4.0 provides enhanced connection management. JDBC 4.0 has added support for connection state tracking using which unusable connections can be identified and closed. The connection state tracking is implemented by the connection pool manager using a new method in the Connection interface, isValid(). The connection pool manager determines if a Connection object is valid by invoking theisValid() method on the Connection object. If the Connection object is not valid the connection pool manager closes the connection. Prior to the new feature, to track connection state the connection pool manager typically had to close all the connections in a connection pool and reinitiate the connection pool if the connection pool performance got reduced due to unusable connections. A connection pool manager implements the connection state tracking as follows:

if(!connection.isValid())
connection.close();

An SQLException in a JDBC application might be chained to other SQLExceptions and a developer would be interested in retrieving the chained exceptions. In JDBC 3.0 the chained exceptions and the chained causes of the exceptions had to be retrieved by invoking thegetNextException() and getCause() methods recursively.

catch(SQLException e)
{
while(e != null)
{
System.out.println("SQLException Message:" + e.getMessage());
Throwable t = e.getCause();
while(t != null)
{
System.out.println("SQLException Cause:" + t);
t = t.getCause();
}
e = e.getNextException();
}
}

JDBC 4.0 has added support for the Java SE chained exception facility also called the cause facility. The support for the Java SE chained exception facility is implemented with following new features.

  • Four new constructors in the SQLException class that have the     Throwable cause as one of the parameters.
  • SQLException class supports the enhanced for-each loop introduced in J2SE 5.0 to retrieve the chained exceptions and chained causes without invoking the getNextException() and getCause() methods recursively.
  • The getCause() method supports non-SQLExceptions.

Chained exceptions and chained causes may be retrieved using the enhanced for-each loop as follows:

catch(SQLException sqlException)
{
for(Throwable e : sqlException )
{
System.out.println("Error encountered: " + e);
}
}

JDBC 4.0 drivers have also added support for SQL data types ROWID and National Character Set data types NCHAR, NVARCHAR, LONGNVARCHAR, and NCLOB in the RowSet interface.

The WebRowSetQuery class used in this chapter with the chained exceptions retrieved using the enhanced for-each loop is listed below:

package webrowset;
import oracle.jdbc.rowset.*;
import java.io.*;
import java.sql.SQLException;
public class WebRowSetQuery
{
public OracleWebRowSet webRowSet;
public String selectQuery;
public WebRowSetQuery() {
}
public WebRowSetQuery(OracleWebRowSet webRowSet)
{
this.webRowSet = webRowSet;
}
public void generateWebRowSet(String selectQuery)
{
try
{
webRowSet = new OracleWebRowSet();
webRowSet.setDataSourceName("jdbc/OracleDataSource");
webRowSet.setCommand(selectQuery);
webRowSet.setUsername("oe");
webRowSet.setPassword("pw");
webRowSet.setReadOnly(false);
webRowSet.setFetchSize(5);
webRowSet.setMaxRows(3);
webRowSet.execute();
}
catch (SQLException sqlException)
{
for (Throwable e: sqlException)
{
System.out.println("Error encountered: " + e);
}
}
}
public void generateXMLDocument()
{
try
{
OutputStreamWriter output =
new OutputStreamWriter(new FileOutputStream(new
File("c:/output/output.xml")));
webRowSet.writeXml(output);
} catch (SQLException sqlException)
{
for (Throwable e: sqlException)
{
System.out.println("Error encountered: " + e);
}
}
catch (IOException e)
{
}
}
public void deleteRow(int row)
{
try
{
webRowSet.absolute(row);
webRowSet.deleteRow();
} catch (SQLException sqlException)
{
for (Throwable e: sqlException)
{
System.out.println("Error encountered: " + e);
}
}
}
public void insertRow(String journal, String publisher, String
edition,
String title, String author)
{
try
{
webRowSet.moveToInsertRow();
webRowSet.updateString(1, journal);
webRowSet.updateString(2, publisher);
webRowSet.updateString(3, edition);
webRowSet.updateString(4, title);
webRowSet.updateString(5, author);
webRowSet.insertRow();
} catch (SQLException sqlException)
{
for (Throwable e: sqlException)
{
System.out.println("Error encountered: " + e);
}
}
}
public void updateRow(int rowUpdate, String journal, String
publisher,
String edition, String title, String author)
{
try
{
webRowSet.absolute(rowUpdate);
webRowSet.updateString(1, journal);
webRowSet.updateString(2, publisher);
webRowSet.updateString(3, edition);
webRowSet.updateString(4, title);
webRowSet.updateString(5, author);
webRowSet.updateRow();
} catch (SQLException sqlException)
{
for (Throwable e: sqlException)
{
System.out.println("Error encountered: " + e);
}
}
}
public String[] readRow(int rowRead)
{
String[] resultSet = null;
try
{
resultSet = new String[5];
webRowSet.absolute(rowRead);
resultSet[0] = webRowSet.getString(1);
resultSet[1] = webRowSet.getString(2);
resultSet[2] = webRowSet.getString(3);
resultSet[3] = webRowSet.getString(4);
resultSet[4] = webRowSet.getString(5);
} catch (SQLException sqlException)
{
for (Throwable e: sqlException)
{
System.out.println("Error encountered: " + e);
}
}
return resultSet;
}
public void updateDatabase()
{
try {
webRowSet.acceptChanges();
} catch (SQLException sqlException)
{
for (Throwable e: sqlException)
{
System.out.println("Error encountered: " + e);
}
}
}
}

Summary

We can proudly say that we have covered a lot of ground. We have learned setting the environment, creating a web RowSet, modifying a database table with web RowSet, creating a new row, updating a row, deleting a row, updating a database table, and finally JDBC 4.0 version.

A persistent connection with a database is required to make updates to the database with the ResultSet interface. The RowSet extends the ResultSet interface. RowSet has the advantage of not requiring a persistent JDBC database connection for the modification of data. WebRowSet interface further extends the RowSet interface and represents a RowSet object as an XML document, thus facilitating the transfer of data for query and modification by remote clients who are not connected to the database. JDBC 4.0 features such as connection state tracking and Java SE chained exceptions facility may be availed of in a Web RowSet application in a server that supports JDBC 4.0.

 

If you have read this article you may be interested to view :

 

About the Author :


Deepak Vohra

Deepak Vohra is a consultant and a principal member of the NuBean.com software company. Deepak is a Sun Certified Java Programmer and Web Component Developer, and has worked in the fields of XML and Java programming and J2EE for over five years. Deepak is the co-author of the Apress book Pro XML Development with Java Technology and was the technical reviewer for the O'Reilly book WebLogic: The Definitive Guide. Deepak was also the technical reviewer for the Course Technology PTR book Ruby Programming for the Absolute Beginner, and the technical editor for the Manning Publications book Prototype and Scriptaculous in Action. Deepak is also the author of the Packt Publishing books JDBC 4.0 and Oracle JDeveloper for J2EE Development; Processing XML documents with Oracle JDeveloper 11g; EJB 3.0 Database Persistence with Oracle Fusion Middleware 11g; and Java 7 JAX-WS Web Services.

Books From Packt

Pentaho Reporting 1.0 for Java Developers
Pentaho Reporting 1.0 for Java Developers

Drools JBoss Rules 5.0 Developer's Guide
Drools JBoss Rules 5.0 Developer's Guide

Liferay Portal 5.2 Systems Development
Liferay Portal 5.2 Systems Development

Grails 1.1 Web Application Development
Grails 1.1 Web Application Development

Oracle Essbase 9 Implementation Guide
Oracle Essbase 9 Implementation Guide

Oracle 10g/11g Data and Database Management Utilities
Oracle 10g/11g Data and Database Management Utilities

Mastering Oracle Scheduler in Oracle 11g Databases
Mastering Oracle Scheduler in Oracle 11g Databases

Oracle SOA Suite Developer's Guide
Oracle SOA Suite Developer's Guide

 

 

 

 

No votes yet

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Z
Q
g
T
N
D
Enter the code without spaces and pay attention to upper/lower case.
Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software