Using Database Operations

The Update Operation

ProcedureTo perform an update operation on a table:

  1. Execute the update() method.

  2. Using a while loop together with next(), move to the row that you want to update.

  3. Assign updating value(s) to the fields of the table OTD

  4. Update the row by calling updateRow().


    package prjJDBC_JCDjcdALL;
    
    public class jcdUpdate
    {
    
        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,
    otdJDBC.OtdJDBCOTD otdJDBC_1, dtd.otdOutputDTD882991309.DBemployee
    otdOutputDTD_DBemployee_1, dtd.otdInputDTD_1394195520.DBemployees
    otdInputDTD_DBemployees_1, com.stc.connector.appconn.file.FileApplication
    FileClient_1 ) throws Throwable
        {
            FileClient_1.setText( "Update the Rate and Last_update
     fields using Prepared Statement.. " );
            FileClient_1.write();
            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();
        }
    
    }