Sun Adapter for DB2 Tutorials

jcdTableSelect Collaboration Java Code

The completed Java source code for the jcdTableSelect Collaboration appears as follows:


package prjDB2_JCD_workjcdALL;


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, 
com.stc.connector.appconn.file.FileApplication FileClient_1, dtd.otdOutputDTD262244478.
DB_employee otdOutputDTD_DB_employee_1, otdDB2.OtdDB2OTD otdDB2_1 )
       throws Throwable
   {
       FileClient_1.setText( "Selectiong records from db_employee table via Table 
Select........" );
       FileClient_1.write();
       otdDB2_1.getDB_EMPLOYEE().select( input.getText() );
       while (otdDB2_1.getDB_EMPLOYEE().next()) {
           otdOutputDTD_DB_employee_1.setEmpNo( typeConverter.shortToString( otdDB2_1.
getDB_EMPLOYEE().getEMP_NO(), "#", false, "" ) );
           otdOutputDTD_DB_employee_1.setLastname( otdDB2_1.getDB_EMPLOYEE().
getLAST_NAME() );
           otdOutputDTD_DB_employee_1.setFirstname( otdDB2_1.getDB_EMPLOYEE().
getFIRST_NAME() );
           otdOutputDTD_DB_employee_1.setRate( otdDB2_1.getDB_EMPLOYEE().
getRATE().toString() );
           otdOutputDTD_DB_employee_1.setLastDate( typeConverter.dateToString
( otdDB2_1.getDB_EMPLOYEE().getLAST_UPDATE(), "yyyy-MM-dd hh:mm:ss", false, "" ) );
           FileClient_1.setText( otdOutputDTD_DB_employee_1.marshalToString() );
           FileClient_1.write();
       }
       FileClient_1.setText( "Table Select Done." );
       FileClient_1.write();
   }

} 

Note –

The above code has been wrapped for display purposes.