Skip to content

Conversation

@wuzhengyi
Copy link

When using a multi-host JDBC URL (failover) with the legacy property value zeroDateTimeBehavior=convertToNull, the driver throws an exception stating the only acceptable values are CONVERT_TO_NULL, EXCEPTION, or ROUND. The same property/value works with a single-host URL.
Root cause:
Legacy value translation is applied only per-host in fixHostInfo() via replaceLegacyPropertyValues(hostProps).
In the failover path, FailoverConnectionProxy initializes properties from ConnectionUrl.getConnectionArgumentsAsProperties(), which returns the global properties map (this.properties) that has not been passed through replaceLegacyPropertyValues.
As a result, convertToNull is not normalized to CONVERT_TO_NULL and enum parsing fails in EnumPropertyDefinition.
Impact:
Backward-compatible URLs that rely on convertToNull fail in multi-host scenarios, but succeed in single-host scenarios, creating inconsistent behavior.
Exception (abridged):
com.mysql.cj.exceptions.CJException: The connection property 'zeroDateTimeBehavior' acceptable values are: 'CONVERT_TO_NULL', 'EXCEPTION' or 'ROUND'. The value 'convertToNull' is not acceptable.

… property values. Added tests for global properties handling of zeroDateTimeBehavior and socketFactory settings.
@mysql-oca-bot
Copy link

Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at https://oca.opensource.oracle.com/
Please make sure to include your MySQL bug system user (email) in the returned form.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants