Bug #100079 JDBC's MySQL protocol is not correct, some information will be lost
Submitted: 2 Jul 2020 9:07 Modified: 19 May 2021 7:32
Reporter: Huqing Yan (OCA) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.49 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution, jdbc, protocol

[2 Jul 2020 9:07] Huqing Yan
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] Huqing Yan
I mean, no connection attribute of the JDBC connection
[6 Jul 2020 6:12] Huqing Yan
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] Huqing Yan
I send the OCA PDF about one month ago, but no reply till now
[4 Feb 2021 3:07] Huqing Yan
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 2021 5:27] MySQL Verification Team
Thank you for the contribution.
[17 May 2021 22:27] Filipe Silva
Thank you again for this contribution and for your interest in Connector/J.

Connector/J 5.1 has been EOL since Feb. 9, 2021. The behavior described here is not observable in Connector/J 8.0, therefore your patch won't be applied.

I recommend you to upgrade to Connector/J 8.0.
[19 May 2021 7:32] Huqing Yan
Connector/J 5.1 has been EOL since Feb. 9, 2021.
OK!
I think it does not mean `Can't repeat`, but `won't fix`, otherwise someone will ignore the problem