beautypg.com

The delete operation, 2 the stored procedure, The stored procedure – Sun Microsystems eWay JDBC/ODBC Adapter User Manual

Page 63

background image

Chapter 5

Section 5.2

Using JDBC/ODBC Operations

JDBC eWay Database Operations (JCD)

JDBC/ODBC eWay Adapter User’s Guide

63

Sun Microsytems, Inc.

otdJDBC_1.getUpdate_Ps().setEmp_no(
typeConverter.stringToShort( input.getText(), "#", false, 0 ) );
otdJDBC_1.getUpdate_Ps().executeUpdate();
FileClient_1.setText( "Done Update." );
FileClient_1.write();
}

}

The Delete Operation

To perform a delete operation on a table:

1

Execute the delete() method.

In this example DELETE an employee.

package prjJDBC_JCDjcdALL;

public class jcdDelete
{

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
{
FileClient_1.setText( "Delete record .." );
FileClient_1.write();
otdJDBC_1.getDB_EMPLOYEE().delete( input.getText() );
FileClient_1.setText( "Done delete." );
FileClient_1.write();
}

}

5.2.2

The Stored Procedure

A Stored Procedure OTD represents a database stored procedure. Fields correspond to
the arguments of a stored procedure while methods are the operations that you can
apply to the OTD. It allows you to execute a stored procedure. Remember that while in
the Collaboration Editor you can drag and drop nodes from the OTD into the
Collaboration Editor.