In this section we will create a Web RowSet from a database table and an XML document representation of the Web RowSet is generated. Create a Java class in JDeveloper with File | New | General | Java Class. In the Create Java Class window specify the class name, WebRowSetQuery
, and package name and click on OK. A Java class, WebRowSetQuery.java
gets added to the WebRowSet
project. In the Java application first import the oracle.jdbc.rowset
package classes. Create an OracleWebRowSet
class object:
OracleWebRowSet webRowSet=new OracleWebRowSet();
Set the data source name to obtain a JDBC connection with the database. The data source name is configured in the data-sources.xml
file:
webRowSet.setDataSourceName("jdbc/OracleDataSource");
Set the SQL query command for the OracleWebRowSet
class object:
webRowSet.setCommand(selectQuery);
Variable selectQuery
is the String
value for the SQL statement that is to be used to query the database. SQL statement value is obtained from...