java.sql.SQLException: 找不到存储过程
java.sql.SQLException: Could not find stored procedure
[dbo].[GetUserCredentials]
@Company varchar(255),
@SchedType varchar(255),
@ShiftHours varchar(255),
@UserRole varchar(255),
@UserDesc varchar(255),
@UserOwner varchar(255)
select ... from ... where ...
存储过程^
java调用存储过程的代码
CallableStatement statement = con.prepareCall("{call GetUserCredentials}");
statement.execute();
结果
java.sql.SQLException: Could not find stored procedure 'GetUserCredentials'.
我看到您的存储过程缺少输入参数,添加“?” prepareCall语句中的(输入参数个数)
例如
stmt = con.prepareCall("{call insertEmployee(?,?,?,?,?,?)}");
stmt.setInt(1, id);
stmt.setString(2, name);
stmt.setString(3, role);
stmt.setString(4, city);
stmt.setString(5, country);
看看这个 article 以更好地理解它
[dbo].[GetUserCredentials]
@Company varchar(255),
@SchedType varchar(255),
@ShiftHours varchar(255),
@UserRole varchar(255),
@UserDesc varchar(255),
@UserOwner varchar(255)
select ... from ... where ...
存储过程^
java调用存储过程的代码
CallableStatement statement = con.prepareCall("{call GetUserCredentials}");
statement.execute();
结果
java.sql.SQLException: Could not find stored procedure 'GetUserCredentials'.
我看到您的存储过程缺少输入参数,添加“?” prepareCall语句中的(输入参数个数) 例如
stmt = con.prepareCall("{call insertEmployee(?,?,?,?,?,?)}");
stmt.setInt(1, id);
stmt.setString(2, name);
stmt.setString(3, role);
stmt.setString(4, city);
stmt.setString(5, country);
看看这个 article 以更好地理解它