Version 5.1.46 is a maintenance release of the production 5.1 branch. It is suitable for use with MySQL Server versions 5.5, 5.6, 5.7, and 8.0. It supports the Java Database Connectivity (JDBC) 4.2 API.
Because Connector/J restricted TLS versions to v1.1 and below by default when connecting to MySQL Community Server 8.0 (which used to be compiled with yaSSL by default and thus supporting only TLS v1.1 and below), it failed to connect to to a MySQL 8.0.4 Community Server (which has been compiled with OpenSSL by default and thus supports TLS v1.2) that was configured to only allow TLS v1.2 connections. TLS v1.2 is now enabled for connections with MySQL Community Server 8.0.4 and later. (Bug #27374581)
The bundle for Connector/J 5.1 delivered by Oracle now contains an additional jar package with the name
mysql-connector-java-commercial-5.1.for commercial bundles). It is identical with the other jar package with the original package named
mysql-connector-java-commercial-5.1.for commercial bundles), except for its more Maven-friendly file name. (Bug #27231383)
The lower bound for the connection property
packetDebugBufferSizehas been changed to 1, to avoid the connection errors that occur when the value is set to 0. (Bug #26819691)
For multi-host connections, when a MySQL Server was configured with
Connection.getAutoCommit()did not return the correct value. This was because
useLocalSessionState=truewas assumed for multi-host connections, which might not be the case, resulting thus in inconsistent session states.
With this fix, by default, Connector/J executes some extra queries in the connection synchronization process to guarantee consistent session states between the client and the server at any connection switch. This would mean, however, that when none of the hosts are available during an attempted server switch, an exception for closed connection will be thrown immediately while, in earlier Connector/J versions, there would be a connection error thrown first before a closed connection error. Error handling in some applications might need to be adjusted accordingly.
Applications can skip the new session state synchronization mechanism by having
useLocalSessionState=true. (Bug #26314325, Bug #86741)
Connector/J now supports the new
caching_sha2_passwordauthentication plugin for MySQL 8.0, which is the default authentication plugin for MySQL 8.0.4 and later (see Caching SHA-2 Pluggable Authentication for details).Note
To authenticate accounts with the
caching_sha2_passwordplugin, either a secure connection to the server using SSL or an unencrypted connection that supports password exchange using an RSA key pair (enabled by setting one or both of the connecting properties
serverRSAPublicKeyFile) must be used.
Because earlier versions of Connector/J 5.1 do not support the
caching_sha2_passwordauthentication plugin and therefore will not be able to connect to accounts that authenticate with the new plugin (which might include the root account created by default during a new installation of a MySQL 8.0 Server), it is highly recommended that you upgrade now to Connector/J 5.1.46, to help ensure that your applications continue to work smoothly with the latest MySQL 8.0 Server.
When Connector/J 5.1.44 or earlier connected to MySQL 5.7.20 or later, warnings are issued because Connector/J used the deprecated system variables
tx_read_only. These SQL-level warnings, returned from a
SHOW WARNINGSstatement, might cause some applications to throw errors and stop working. With this fix, the deprecated variables are no longer used for MySQL 5.7.20 and later; also, to avoid similar issues, a
SHOW WARNINGSstatement is no longer issued for the use of deprecated variables. (Bug #27029657, Bug #88227)
When the default database was not specified for a connection, the connection attributes did not get stored in the
session_connect_attrstable in the Performance Schema of the MySQL Server. (Bug #22362474, Bug #79612)