Fixes bugs found since release 5.1.13.
Connector/J's dependence on the
org.apache.commons.loggingpackage has been removed. (Bug #11756133, Bug #48013)
Connector/J's load-balancing functionality only allowed the following events to trigger failover:
Matches to user-defined Exceptions using the loadBalanceSQLStateFailover, loadBalanceSQLExceptionSubclassFailover or loadBalanceExceptionChecker property.
This meant that connections where auto-commit was enabled were not balanced, except for Exceptions, and this was problematic in the case of distribution of read-only work across slaves in a replication deployment.
The ability to load-balance while auto-commit is enabled has now been added to Connector/J. This introduces two new properties:
loadBalanceAutoCommitStatementThreshold - defines the number of matching statements which will trigger the driver to (potentially) swap physical server connections. The default value (0) retains the previously established behavior that connections with auto-commit enabled are never balanced.
loadBalanceAutoCommitStatementRegex - the regular expression against which statements must match. The default value (blank) matches all statements.
Load-balancing will be done after the statement is executed, before control is returned to the application. If rebalancing fails, the driver will silently swallow the resulting Exception (as the statement itself completed successfully). (Bug #55723)
Connection failover left slave/secondary in read-only mode. Failover attempts between two read-write masters did not properly set
this.currentConn.setReadOnly(false). (Bug #58706)
CallableStatementRegressiontest suite failed with a Null Pointer Exception because the
OUTparameter in the
I__S.PARAMETERStable had no name, that is
COLUMN_NAMEhad the value
NULL. (Bug #58232)
Connector/J mapped both 3-byte and 4-byte UTF8 encodings to the same Java UTF8 encoding.
To use 3-byte UTF8 with Connector/J set
useUnicode=truein the connection string.
To use 4-byte UTF8 with Connector/J configure the MySQL server with
character_set_server=utf8mb4. Connector/J will then use that setting as long as
characterEncodinghas not been set in the connection string. This is equivalent to autodetection of the character set. (Bug #58232)
DatabaseMetaData.supportsMultipleResultSets()was hard-coded to return
false, even though Connector/J supports multiple result sets. (Bug #57380)
useOldUTF8Behaviorparameter failed to set the connection character set to
In versions prior to 5.1.3, the handshake was done using
latin1, and while there was logic in place to explicitly set the character set after the handshake was complete, this was bypassed when
useOldUTF8Behaviorwas true. This was not a problem until 5.1.3, when the handshake was modified to use
utf8, but the logic continued to allow the character set configured during that handshake process to be retained for later use. As a result,
useOldUTF8Behavioreffectively failed. (Bug #57262)
Invoking a stored procedure containing output parameters by its full name, where the procedure was located in another database, generated the following exception:
Parameter index of 1 is out of range (1, 0)
When a JDBC client disconnected from a remote server using
Connection.close(), the TCP connection remained in the
TIME_WAITstate on the server side, rather than on the client side. (Bug #56979)
Leaving Trust/ClientCertStoreType properties unset caused an exception to be thrown when connecting with
useSSL=true, as no default was used. (Bug #56955)
When load-balanced connections swap servers, certain session state was copied from the previously active connection to the newly selected connection. State synchronized included:
Transaction isolation state
However, the read-only state was not synchronized, which caused problems if a write was attempted on a read-only connection. (Bug #56706)
When using Connector/J configured for failover (jdbc:mysql://host1,host2,... URLs), the non-primary servers re-balanced when the transactions on the master were committed or rolled-back. (Bug #56429)
An unhandled Null Pointer Exception (NPE) was generated in
DatabaseMetaData.javawhen calling an incorrectly cased function name where no permission to access
In addition to catching potential NPEs, a guard against calling JDBC functions with
db_name.proc_namenotation was also added. (Bug #56305)
Added diagnostic information to
SQLExceptionmessages that are caused by usage of a closed load-balanced connection, to help clarify the root cause of a connection closure. (Bug #56200)
Attempting to use JDBC4 functions on
Connectionobjects resulted in errors being generated:
Exception in thread "main" java.lang.AbstractMethodError: com.mysql.jdbc.LoadBalancedMySQLConnection.createBlob()Ljava/sql/Blob; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.mysql.jdbc.LoadBalancingConnectionProxy.invoke(LoadBalancingConnectionProxy.java:476) at $Proxy0.createBlob(Unknown Source)
Connector/J could exit with a “parameter index out of range” error when executing stored procedures. (Bug #55328, Bug #11762701)