Sun Adapter for SQL Server Tutorials

jcdTableSelect Collaboration Java Code

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


package prjSQLServer_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.otdOutputDTD_469610704.DBemployee otdOutputDTD_DBemployee_1, 
otdSQLServer.OtdSQLServerOTD otdSQLServer_1, com.stc.connector.appconn.
file.FileApplication FileClient_1 )
       throws Throwable
   {
       FileClient_1.setText( "Selecting record(s) from db_employee table via 
table select .." );
       FileClient_1.write();
       otdSQLServer_1.getDb_employee().select( input.getText() );
       while (otdSQLServer_1.getDb_employee().next()) {
           otdOutputDTD_DBemployee_1.setEmpNo( Integer.toString( otdSQLServer_1.
getDb_employee().getEMP_NO() ) );
           otdOutputDTD_DBemployee_1.setLastname( otdSQLServer_1.getDb_employee().
getLAST_NAME() );
           otdOutputDTD_DBemployee_1.setFirstname( otdSQLServer_1.getDb_employee().
getFIRST_NAME() );
           otdOutputDTD_DBemployee_1.setRate( Double.toString( otdSQLServer_1.
getDb_employee().getRATE() ) );
           otdOutputDTD_DBemployee_1.setLastDate( otdSQLServer_1.getDb_employee().
getLAST_UPDATE().toString() );
           FileClient_1.setText( otdOutputDTD_DBemployee_1.marshalToString() );
           FileClient_1.write();
       }
       FileClient_1.setText( "Done table select." );
       FileClient_1.write();
   }

} 

Note –

The above code has been wrapped for display purposes.