简体   繁体   English

com.microsoft.sqlserver.jdbc.sqlserverexception:参数编号1无效

[英]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.

相关问题 com.microsoft.sqlserver.jdbc.SQLServerException:未为参数编号1设置值 - com.microsoft.sqlserver.jdbc.SQLServerException: The value is not set for the parameter number 1 com.microsoft.sqlserver.jdbc.SQLServerException:未为参数编号4设置值 - com.microsoft.sqlserver.jdbc.SQLServerException :The value is not set for the parameter number 4 嵌套的异常是com.microsoft.sqlserver.jdbc.SQLServerException:输出参数的索引0无效 - nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The index 0 of the output parameter is not valid com.microsoft.sqlserver.jdbc.SQLServerException 与 jpa - com.microsoft.sqlserver.jdbc.SQLServerException with jpa com.microsoft.sqlserver.jdbc.sqlserverexception:列名count(pr)无效 - com.microsoft.sqlserver.jdbc.sqlserverexception:the column name count(pr) is not valid com.microsoft.sqlserver.jdbc.SQLServerexception:&#39;=&#39;附近的语法不正确 - com.microsoft.sqlserver.jdbc.SQLServerexception:incorrect syntax near'=' com.microsoft.sqlserver.jdbc.SQLServerException:用户登录失败 - com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 无法创建交易异常:com.microsoft.sqlserver.jdbc.SQLServerException 登录错误 - CannotCreateTransactionException: com.microsoft.sqlserver.jdbc.SQLServerException Login Error com.microsoft.sqlserver.jdbc.SQLServerException:&#39;GO&#39;附近的语法不正确 - com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 'GO' com.microsoft.sqlserver.jdbc.SQLServerException: &#39;)&#39; 附近的语法不正确 - com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near ')'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM