jdbc调用mysql存储函数问题

 

在本地调用时,出现以下错误:

User does not have access to metadata required to determine storedprocedure parameter types. If rights can not be granted, configureconnection with "noAccessToProcedureBodies=true" to have drivergenerate parameters that represent INOUT strings irregardless of actualparameter types.
1.确保权限
解决办法是进行权限赋值

以root用户登陆将mysql.proc的表赋给相应的调用用户

GRANT SELECT, INSERT, UPDATE ON `mysql`.`proc` TO 'syzj'@'localhost';

赋权后问题解决。

在此记录一下。

 

2.url连接加入&noAccessToProcedureBodies=true

控制台显示Mysql错误:"User does not have access to metadata required to determine stored procedure parameter types. ...... "。网上说在数据源配置的url里,加上"&noAccessToProcedureBodies=true"就可以了。我试了试,控制台又提示说:"The user specified as a definer('username'@'%') does not exist"。这个用户当时赋予权限时,是username@localhost,改为username@%就好了。

 

 

参考:

http://cau99.blog.51cto.com/1855224/348792

你可能感兴趣的:(mysql)