当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Cannot execute a stored procedure (jdbc). 'noAccessToProcedureBodies=true'

问题描述:

We have a java tomcat server on one end, and a mysql on the other.

We are using mysql-connector-java, tried with versions 5.1.11 and 5.1.22. The mysql server version is 5.5.26

We do not have all the permissions for the mysql.proc table, as it is a security risk to all databases.

I can execute the procedures when I log in mysql with the given username and password, but when used from java (jdbc) it blows up with

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.

I tried the suggestion mysql has given, used 'noAccessToProcedureBodies=true' in our jdbc connection URL's. Didn't help at all! No difference whatsoever. (Here is an example of jdbc connection string I used: jdbc:mysql://xxxxxx:xxxx/xxxx?noAccessToProcedureBodies=true&useInformationSchema=true )

As I read http://bugs.mysql.com/bug.php?id=61203 I saw there is a bug in the connector and I tried using useInformationSchema=true as suggested. Didn't help, and neither did updating the mysql-connector-java, even though the bug is supposed to be fixed.

Has anyone faced this? I guess I am doing something wrong, everyone says it should work but for me it doesnt.

Thanks in advance!

网友答案:

Haven't verified it... just use this: useInformationSchema=true for sql URL. (dont put noAccessToBodies).

网友答案:

I have MySQL Server Version : 5.1.52
My SQL Connector jar : mysql-connector-java-5.1.7-bin.jar
Tomcat : 7.0.27.0
JDK 1.6.0.18

The above problem got solved by adding noAccessToProcedureBodies=true and it works for me !

分享给朋友:
您可能感兴趣的文章:
随机阅读: