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

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.

The second row values are retrieved from the Web RowSet:

In the ReadRow JSP the readRow() method of the WebRowSetQuery.java application is invoked. The WebRowSetQuery 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 the ReadRow JSP fields. In the readRow() method the OracleWebRowSet 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...