Chapter 5
Section 5.2
Using JDBC/ODBC Operations
JDBC eWay Database Operations (JCD)
JDBC/ODBC eWay Adapter User’s Guide
60
Sun Microsytems, Inc.
operation. Check with the respective driver’s vendor for further information. This
feature is known as Updatable ResultSet.
Note:
Refer to the Javadoc for a full description of methods included in the JDBC eWay.
5.2.1
The Table
A table OTD represents a database table. It consists of fields and methods. Fields
correspond to the columns of a table while methods are the operations that you can
apply to the OTD. This allows you to perform Query, Update, Insert, and Delete SQL
operations in a table. The ability to update via a ResultSet is called “Updatable
ResultSet”, which is a feature supported by this eWay.
By default, the Table OTD has UpdatableConcurrency and ScrollTypeForwardOnly.
Normally you do not have to change the default setting.
The type of result returned by the select() method can be specified using:
SetConcurrencytoUpdatable
SetConcurrencytoReadOnly
SetScrollTypetoForwardOnly
SetScrollTypetoScrollSensitive
SetScrollTypetoInsensitive
The Query (Select) Operation
To perform a query operation on a table:
1
Execute the
select()
method with the “
where
” clause specified if necessary.
2
Loop through the ResultSet using the
next()
method.
3
Process the return record within a
while()
loop.
For example:
package prjJDBC_JCDjcdALL;
public class jcdTableSelect
{
public com.stc.codegen.logger.Logger logger;
public com.stc.codegen.alerter.Alerter alerter;
public com.stc.codegen.util.CollaborationContext collabContext;
public com.stc.codegen.util.TypeConverter typeConverter;
public void receive(
com.stc.connector.appconn.file.FileTextMessage input,
dtd.otdInputDTD_1394195520.DBemployees otdInputDTD_DBemployees_1,
otdJDBC.OtdJDBCOTD otdJDBC_1, dtd.otdOutputDTD882991309.DBemployee
otdOutputDTD_DBemployee_1,
com.stc.connector.appconn.file.FileApplication FileClient_1 )
throws Throwable