Bug #70927 Connector/J COM_CHANGE_USER handling is broken
Submitted: 16 Nov 2013 9:38 Modified: 5 May 2015 16:36
Reporter: István Tóth Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.27 OS:Any
Assigned to: Alexander Soklakov CPU Architecture:Any

[16 Nov 2013 9:38] István Tóth
Description:
Sometime between 5.1.16, and 5.1.20 the change user functionality in Connector/J has come to depend on the server bug described in 
http://bugs.mysql.com/bug.php?id=70865

This means that if the bug 70865 ever gets fixed, it will break the change user functionality in Connector/J.

The com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource interface, used by some DB pooling implementations depends on change user functionality working.

For detailed analysis of the bug, and the test case, see 
https://mariadb.atlassian.net/browse/MDEV-5155

How to repeat:
Run the attached MariaDBTestCase.java against a Mysql server that does not exhibit the broken behaviour described in #70865. Currently it means a recent MariaDB server, such as MariaDB 5.5.33a.

Suggested fix:
I am attaching a suggested patch against Connector/J 5.1.27.
[16 Nov 2013 9:39] István Tóth
Suggested fix

Attachment: connectorJ-5.1.27-mariaDb.patch (text/x-diff), 756 bytes.

[16 Nov 2013 9:41] István Tóth
Test case

Attachment: MariaDBTestCase.java (text/x-java), 945 bytes.

[18 Nov 2013 9:30] Alexander Soklakov
Hi István,

Thank you for this report.
Verified as described.
[11 Apr 2014 15:24] Alexander Soklakov
Bug#71948 was marked as duplicate of this one.
[5 May 2015 16:36] Daniel So
Added the following entry to the Connector/J 5.1.36 changelog:

"The change user functionality in Connector/J was dependent on Bug# 70865 of the MySQL server (for releases 5.5 and later, the server unnecessarily sends a plugin_request_packet for every COM_CHANGE_USER packet). That dependence made the com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource interface fail for server versions or forks that did not have the same bug. This fix removes that dependence and makes the interface function properly, whether the server suffers Bug# 70865 or not."