[英]I am not sure what's wrong "Parameter number 2 is not an OUT parameter"
try{
Class.forName("com.mysql.jdbc.Driver");
mycon = DriverManager.getConnection("jdbc:mysql://localhost:3306/schoolDb?autoReconnect=true&useSSL=false", "root", "Banita");
CallableStatement cs = mycon.prepareCall("{call showData(?, ?, ?)}");
cs.setInt(1, 20);
cs.registerOutParameter(2, Types.INTEGER);
cs.registerOutParameter(3, Types.CHAR);
cs.executeUpdate();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
Did i do something on create procedure parameter here ?我在这里对创建过程参数做了什么吗?
CREATE DEFINER=`root`@`localhost` PROCEDURE `showData`(in id int, out deptNO int, out LOC char(12))
BEGIN
select DEPTNO, LOC INTO deptNO, LOC from schooolDb.UDP_DEPT_DNAME where deptNO = id;
END
Try尝试
CREATE DEFINER=`root`@`localhost` PROCEDURE `showData`(in id int, out o_deptno int, out o_loc char(12))
BEGIN
select DEPTNO, LOC INTO o_deptno, o_loc from schooolDb.UDP_DEPT_DNAME where DEPTNO = id;
END
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.