Bug #99076 Unclear exception/error when connecting with jdbc:mysql to a mysqlx port
Submitted: 26 Mar 2020 7:43 Modified: 1 Aug 2020 22:23
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:8.0.19 OS:Any
Assigned to: CPU Architecture:Any
Tags: usability

[26 Mar 2020 7:43] Daniël van Eeden
Description:
If you by accident specify the wrong port: e.g. "jdbc:mysql://127.0.0.1:13306/" instead of "jdbc:mysql://127.0.0.1:3306/" then the exception that's raised is java.lang.ArrayIndexOutOfBoundsException which doesn't make it clear what the issue is.

This is more likely to happen when using non-standard ports (e.g. docker, dbdeployer, etc)

How to repeat:
Specify a X Protocol port for a classic protocol connection with JDBC.

Suggested fix:
Throw something like UnsupportedProtocolException or something else that makes it clear what the real issue is.
[26 Mar 2020 11:38] MySQL Verification Team
Hello Daniël,

Thank you for the report and feedback.

regards,
Umesh
[1 Aug 2020 22:23] Daniel So
Posted by developer:
 
Added the following entry to the C/J 8.0 changelog: 

"When connecting to a server's X Protocol port with the JDBC protocol, Connector/J threw an ArrayIndexOutOfBoundsException. With this fix, Connector/J throws the proper exception for using the wrong protocol and returns a proper message"
[13 Oct 2020 16:31] Daniel So
Posted by developer:
 
Corrected the changelog entry to the following: 

"When a client attempted to establish a JDBC connection using the server's X Protocol port, Connector/J threw an ArrayIndexOutOfBoundsException. With this fix, Connector/J throws the proper exception for using the wrong protocol with the port and returns a proper error message."