在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的访问权限:
flush privileges;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/18945822/viewspace-683363/
,如需转载,请注明出处,否则将追究法律责任。