ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 使用JDBC调用存储过程时的注意事项

使用JDBC调用存储过程时的注意事项

原创 Linux操作系统 作者:horonunu 时间:2011-01-06 13:37:14 0 删除 编辑
在JAVA中调用prepareCall()方法调用存储过程的时候,有时会遇到以下报错:
java.sql.SQLException: 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
 
经过查阅资料得知,在调用prepareCall()的时候,不光用户要有execute的权限,还需要对mysql.proc具有访问权限。否则它无法访问metadata。所以解决的办法就是除了应该具有相应库的execute权限外,还要执行以下命令,使用户获得mysql.proc的访问权限:
grant select on mysql.proc to user@host;
flush privileges;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/18945822/viewspace-683363/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2011-01-04

  • 博文量
    2
  • 访问量
    10326