En error is appearing while calling the stored procedure below. The stored procedure is written in MySQL, and the call is done from my computer to the MySQL server.
//this is my code to call the procedure
try {
CallableStatement cStmt = con.prepareCall("{call beta.Pr_branch_master(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}"); // my procedure name
cStmt.setString(1,"N");
cStmt.setString(2, tranDate);
cStmt.setInt(3,0);
cStmt.setString(4, branchStartDt);
cStmt.setInt(5, Integer.parseInt(orgMstID));
// cStmt.setInt(4,Types.INTEGER);
cStmt.setString(6, brType);
cStmt.setString(7, branchName);
cStmt.setString(8, address);
cStmt.setString(9, area);
cStmt.setString(10, city);
cStmt.setString(11, state); // these are my parameters to be inserted into the table
cStmt.setString(12, pinCode);
cStmt.setString(13, phoneNo);
cStmt.setString(14, mobileNo);
cStmt.setString(15, emailID);
cStmt.setString(16, regCode);
cStmt.setString(17, activeFlag);
cStmt.setInt(18, 1);
cStmt.setString(19, enterDesc);
// cStmt.registerOutParameter(19,Types.INTEGER);
// cStmt.setString(19,branchMstID);
// cStmt.setInt(19, 0);
System.out.println("cstmt before out>>>>"+cStmt);
cStmt.registerOutParameter(20, Types.INTEGER);
boolean b = cStmt.execute();// executing the statement
System.out.println("b "+b+" :"+cStmt);
primaryKey = cStmt.getInt(20);
System.out.println("str "+primaryKey);
if(primaryKey > 0 ){
/*dbResult = "success";
result.setStatus(dbResult);*/
result.setMsg("Record Save Successfully.");
} else {
/*dbResult = "error";
result.setStatus(dbResult);*/
result.setMsg("Record Not Save.");
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
// I'm getting an error message while calling the stored procedure
My sql connector jar file was not compatible. previously using 5.01 now using 5.12
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.