Bug #63839 MySQL connector ignore 'noAccessToProcedureBodies=true' parameter
Submitted: 22 Dec 2011 13:06 Modified: 22 Dec 2011 13:13
Reporter: Maxim Sharai Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:5.1.15-5.1.18 OS:Linux
Assigned to: CPU Architecture:Any

[22 Dec 2011 13:06] Maxim Sharai
Description:
MySQL Version: Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (x86_64) using readline 6.1

I have a mysql user with only execute procedures permissions.

My MyBatis connection config:
<dataSource type="POOLED">
    <property name="driver" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://localhost:3306/mydatabase?noAccessToProcedureBodies=true"/>
    <property name="username" value="testuser"/>
    <property name="password" value="test"/>
</dataSource>

After run, I get next exception:
'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.'

But when I change mysql-connector-java version from 5.1.15 to 5.1.10. It's work fine. I also checked connector's 5.1.18 version. I get the same error.

How to repeat:
1.) Run for root user:
CREATE DATABASE mydatabase;
USE mydatabase;

CREATE TABLE TYPES (id INT, name VARCHAR(250));
insert into database_type (id, name) values (1, 'testType1');
insert into database_type (id, name) values (2, 'testType2');
insert into database_type (id, name) values (3, 'testType3');
insert into database_type (id, name) values (4, 'testType4');

create procedure QueryTypes()
SELECT id, name FROM types;

CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'test';
GRANT EXECUTE ON mydatabase.* TO 'testuser'@'localhost' identified by 'test';

2). Configure MyBatis:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
	PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
	"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    .....
    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC"/>
	    <dataSource type="POOLED">
	        <property name="driver" value="com.mysql.jdbc.Driver"/>
		<property name="url" value="jdbc:mysql://localhost:3306/mydatabase?noAccessToProcedureBodies=true"/>
		<property name="username" value="testuser"/>
		<property name="password" value="test"/>
	    </dataSource>
	</environment>
    </environments>
    .....
</configuration>

3). Call the stored procedure from your application
[22 Dec 2011 13:13] Tonci Grgin
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.

Explanation: This is a duplicate of BUG#61203 which is worked on
[16 Dec 10:48] Tonci Grgin
Cyril, please use useInformationSchema=true as a workaround for now while I check against 5.5 server.