[英]com.microsoft.sqlserver.jdbc.sqlserverexception: the parameter number 1 is not valid
Using JDBC SQL driver, I receive the following error: 使用JDBC SQL驱动程序,我收到以下错误:
com.microsoft.sqlserver.jdbc.sqlserverexception: the parameter number 1 is not valid.
The relevant code is as follows: 相关代码如下:
CallableStatement preparedCall;
String sql = "{call [dbo].[my_sproc] (?) }";
preparedCall = conn.prepareCall(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
DBLookup.setObject(preparedCall, 1, "Some value");
ParameterMetaData pmd = ps.getParameterMetaData();
int parameterType = pmd.getParameterType(1); //<-- here is where it's thrown
This can be caused by the connecting user credentials not having appropriate access to the stored procedure in SQL Server. 这可能是由于连接的用户凭据对SQL Server中的存储过程没有适当的访问权所致。
Grant EXECUTE permissions and this should be resolved. 授予EXECUTE权限,这应该可以解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.