title: java.sql.SQLException: Parameter number 2 is not an OUT parameter
body: <p>I am getting an Error while running this:</p>
  
  <pre><code>1. cs = getCon1().prepareCall("{CALL SaveLabourWageDetails(?,?)}");
  
  2. cs.setString(1, user.getUserId());
  
  3. cs.registerOutParameter(2, java.sql.Types.INTEGER); //&lt;--- ERROR at this line
  
  4. cs.execute();
  
  5. String lastIsertId=cs.getString(2);
  </code></pre>
  
  <p>The  Stored Procedure is :</p>
  
  <pre><code>CREATE
  
      PROCEDURE `cheque_alert`.`SaveLabourDetailsHead`(IN wage_entered_by VARCHAR(10),OUT LastInsertId INT)
  
      BEGIN
      INSERT INTO `cheque_alert`.`labour_wage_head`
              (
               `wage_entered_by`,
               `entered_date_time`)
      VALUES (wage_entered_by,
           NOW());
  
            SELECT LAST_INSERT_ID() INTO LastInsertId;
  
      END$$
  
  DELIMITER ;
  </code></pre>
  
  <p>Please point out the problem in this code..</p>