Book Image

JDBC 4.0 and Oracle JDeveloper for J2EE Development

Book Image

JDBC 4.0 and Oracle JDeveloper for J2EE Development

Overview of this book

Table of Contents (20 chapters)
JDBC 4.0 and Oracle JDeveloper for J2EE Development
Credits
About the Author
About the Reviewer
Preface

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. In the ModifyWebRowSet JSP, click on the Update Database link. In the UpdateDatabase.jsp, click on Apply.

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 the acceptChanges() 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...