Note that there are some explanatory texts on larger screens.

plurals
  1. POCalling MySQL procedure sometimes results in Exception "Incorrect integer value: '@com_mysql_jdbc_outparam_11' for column '_NewID' at row 1"
    primarykey
    data
    text
    <p>I'm sporadically facing a strange exception while calling a Stored Procedure in MySQL from Java JDBC driver. My application code looks like:</p> <pre><code>int newID = 0; if (myObj != null) newID = myObj.getId(); //getId() returns an int value... CallableStatement stmt = conn.prepareCall("{CALL MySP(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}"); stmt.registerOutParameter(14, Types.INTEGER); stmt.registerOutParameter(15, Types.BIT); stmt.setShort(1, status); ... // other setters for each parameter of the stored procedure stmt.setInt(14, newID); stmt.execute(); newID = stmt.getInt(14); createdNew = stmt.getBoolean(15); </code></pre> <p>Executing the statement results in a success in 99% of the cases, except few times when an Exception is raised:</p> <pre><code>java.sql.SQLException: Incorrect integer value: '@com_mysql_jdbc_outparam_13' for column '_NewID' at row 1 </code></pre> <p>EDIT: This is the body of the stored procedure:</p> <pre><code>delimiter $$ CREATE PROCEDURE `AddPhysNode`( IN _a SMALLINT,IN _b BIGINT,IN _c BIT,IN _d VARCHAR(255),IN _e LONGBLOB,IN _f LONGBLOB,IN _g INT,IN _h SMALLINT,IN _i SMALLINT,IN _l SMALLINT, IN _m BIT,IN _n INT,IN _o BIGINT,INOUT _NewID INT,OUT _CreatedNew BIT ) BEGIN IF (_NewID &gt; 0) THEN UPDATE tbl SET a = _a WHERE Id = _NewID; SET _CreatedNew = 0; ELSE INSERT INTO tbl (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`i`,`l`,`m`,`n`,`o`) VALUES (_a,_b,_c,_d,_e,_f,_g,_h,_i,_l,_m,_n,_o); SET _CreatedNew = 1; SET _NewID = @@IDENTITY; END IF; END$$ </code></pre> <p>Any hint about this?</p> <p>Thank you very much!</p> <p>Best</p> <p>cghersi</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload