JDBC Connection execution MySQL stored procedure report permission error

Source: Internet
Author: User

There was a sudden error in testing the project today.

User does not has access to metadata required to determine stored procedure parameter types. If rights can not is granted, configure connection with "Noaccesstoprocedurebodies=true" to has driver generate parameter s that represent INOUT strings irregardless of actual parameter types.

The simple explanation is that JDBC calls the stored procedure not only for the user to have Execute permission, but also to have access to mysql.proc. Otherwise it cannot access the metadata.

There are two ways to resolve the discovery data:

One: Set a Noaccesstoprocedurebodies property to the database connection, the property value is True

eg

Jdbc:mysql://192.168.1.111:3306/test?  

Online says setting up Noaccesstoprocedurebodies=true will bring some impact (not verified):

1. When a stored procedure is called, no type checking is set to the string type, and all arguments are set to the int type, but no exception is thrown when Registeroutparameter is called.

2. The query results of a stored procedure cannot be obtained using GETXXX (String parametername) and can only be obtained by getxxx (int parameterindex).

Second: assigning rights to the database user, assigning the SELECT permission to execute the MYSQL.PROC table

eg

GRANT SELECT on Mysql.proc to ' user ' @ ' localhost ';  

JDBC Connection execution MySQL stored procedure report permission error

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.