Bug #100079 JDBC's MySQL protocol is not correct,some information will be lost
Submitted: 2 Jul 2020 9:07 Modified: 28 Jul 2020 2:21
Reporter: Yan Huqing (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.40 and other, 8.0.20 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution, jdbc, protocol

[2 Jul 2020 9:07] Yan Huqing
Description:
JDBC's MySQL protocol of Protocol::HandshakeResponse41 is not correct,
so JDBC's CLIENT_CONNECT_ATTRS can not be seen in performance_schema.session_connect_attrs

How to repeat:
1. java code like attachment and execute it.
The most import code is the URL NOT contains schema name,like this:
jdbc:mysql://127.0.0.1:3306?connectionAttributes=key1:value1 
2. login in MySQL server, execute the query:
select * from performance_schema.session_connect_attrs;
3.but you can not see any connection Attributes

Suggested fix:
remove the code 1852 to 1854 from com.mysql.jdbc.MysqlIO.java
[2 Jul 2020 9:16] Yan Huqing
I mean, no connection attribute of the JDBC connection
[6 Jul 2020 6:12] Yan Huqing
patch based on JDBC5.1.40

Attachment: jdbc_without_default_db.diff (application/octet-stream, text), 583 bytes.

[10 Jul 2020 7:46] MySQL Verification Team
Hello tiger lan,

Thank you for the report and test case.

regards,
Umesh
[10 Jul 2020 7:55] MySQL Verification Team
Please note that in order to submit contributions you must first sign the Oracle Contribution Agreement (OCA). More details are described in "Contributions" tab, please ensure to re-send the patch via that tab. Otherwise we would not be able to accept it.
[28 Jul 2020 2:21] Yan Huqing
I send the OCA PDF about one month ago, but no reply till now
[4 Feb 3:07] Yan Huqing
JDBC's MySQL protocol of Protocol::HandshakeResponse41 is not correct, so JDBC's CLIENT_CONNECT_ATTRS can not be seen in perform

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: jdbc_without_default_db.diff (application/octet-stream, text), 583 bytes.

[4 Feb 5:27] MySQL Verification Team
Thank you for the contribution.