Quick Tip: Granting access to meta-data on MySQL
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.
Well, I have come across this now a couple of times and for some reason I just cannot remember how to either configure the connection to use the "noAccessToProcedureBodies=true" switch or what the exact SQL is that I need to execute to give the user the appropriate access. This time however I decided it is time that I place this information somewhere I can easily find it again and where it can potentially also help out others. Believe me to find the solution to this via Google searches takes a while... So, I naturally thought of the DZone network and the SQL zone in particular. Enough talk then, below follows the solutions for both scenarios. For the second one however, you will need a version of the Connector/J equal to or above version 5.0.3.
If you have root access to your MySQL database then you can simply run a query on the database to resolve the problem. What the query will do is give the specified user the needed rights on the mysql.proc table. This takes the form of the following GRANT SQL query:
GRANT [SELECT, INSERT, UPDATE] ON `mysql`.`proc` TO 'myuser'@'myhost';That's it, after running this query on the database the above exception goes away. If however, you do not have the needed root access to run this query on the database then below is the connection string to use to get around this problem. Very simple, just add &noAccessToProcedureBodies=true to your current connection string and you are done.
String connectionURL = "jdbc:mysql://localhost:3306/mydatabase?user=myuser&password=mypassword&noAccessToProcedureBodies=true"I sincerely hope this tip will help out someone else. If not, well, then at least I now know where to go the next time I run into this problem :)
- Login or register to post comments
- 391 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)






