MYSQL使用问题汇集
仅记录个人认为值得记录
JAVA调用存储过程
1. 使用mysql-connector-java-5.1.18-bin.jar在数据库5.0.8时可以查询表,执行存储过程时无异常抛出,但是程序会挂在这。换用mysql-connector-java-5.0.8-bin.jar OK.2. 在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;其他补充
暂无