您的位置:首页 > 其它

Parameter number X is not an OUT parameter

2015-07-14 00:00 681 查看
摘要: 解决java.sql.SQLException: Parameter number X is not an OUT parameter

开发过程中遇到这个问题,试着按网上的方式解决:
http://blog.csdn.net/lutinghuan/article/details/9271311

只能说然并卵。

其实,有可能是连接mysql的用户没有procedure的执行权限导致的。
此次我碰到的问题就是这样,记录下来!

GRANT EXECUTE ON ichson_lore_source.* TO 'loresource_opr'@'%';
GRANT SELECT ON `mysql`.`proc` TO 'loresource_opr'@'%'

没有授予EXECUTE的权限,也是报出如下的错误:

### Cause: java.sql.SQLException: Parameter number 2 is not an OUT parameter
; SQL []; Parameter number 2 is not an OUT parameter; nested exception is java.sql.SQLException: Parameter number 2 is not an OUT parameter
org.springframework.dao.TransientDataAccessResourceException:
### Error querying database.  Cause: java.sql.SQLException: Parameter number 2 is not an OUT parameter
### The error may exist in file [/data/loresource-tomcat/work/Catalina/localhost/_/WEB-INF/classes/sql-mapping/sequence.xml]
### The error may involve com.ichson.loresource.repo.SequenceRepo.querySeq
### The error occurred while executing a query
### SQL: {call next_val(         ?,         ?,         ?,         ?         )}
### Cause: java.sql.SQLException: Parameter number 2 is not an OUT parameter
; SQL []; Parameter number 2 is not an OUT parameter; nested exception is java.sql.SQLException: Parameter number 2 is not an OUT parameter

如果不授予
mysql
.
proc
的权限,会报metadata没有权限的问题。

### Cause: java.sql.SQLException: User does not have access to metadata required to determine stored procedure parameter types. If rights can not be granted, configur
e connection with "noAccessToProcedureBodies=true" to have driver generate parameters that represent INOUT strings irregardless of actual parameter types.
; SQL []; User does not have access to metadata required to determine stored procedure parameter types. If rights can not be granted, configure connection with "noAcc
essToProcedureBodies=true" to have driver generate parameters that represent INOUT strings irregardless of actual parameter types.; nested exception is java.sql.SQLEx
ception: User does not have access to metadata required to determine stored procedure parameter types. If rights can not be granted, configure connection with "noAcce
ssToProcedureBodies=true" to have driver generate parameters that represent INOUT strings irregardless of actual parameter types.
org.springframework.dao.TransientDataAccessResourceException:
### Error querying database.  Cause: java.sql.SQLException: User does not have access to metadata required to determine stored procedure parameter types. If rights ca
n not be granted, configure connection with "noAccessToProcedureBodies=true" to have driver generate parameters that represent INOUT strings irregardless of actual pa
rameter types.
### The error may exist in file [/data/loresource-tomcat/work/Catalina/localhost/_/WEB-INF/classes/sql-mapping/sequence.xml]
### The error may involve com.ichson.loresource.repo.SequenceRepo.querySeq
### The error occurred while executing a query
### SQL: {call next_val(         ?,         ?,         ?,         ?         )}
### Cause: java.sql.SQLException: User does not have access to metadata required to determine stored procedure parameter types. If rights can not be granted, configur
e connection with "noAccessToProcedureBodies=true" to have driver generate parameters that represent INOUT strings irregardless of actual parameter types.
; SQL []; User does not have access to metadata required to determine stored procedure parameter types. If rights can not be granted, configure connection with "noAcc
essToProcedureBodies=true" to have driver generate parameters that represent INOUT strings irregardless of actual parameter types.; nested exception is java.sql.SQLEx
ception: User does not have access to metadata required to determine stored procedure parameter types. If rights can not be granted, configure connection with "noAccessToProcedureBodies=true" to have driver generate parameters that represent INOUT strings irregardless of actual parameter types.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: