MySQL Connector/J 5.1 Release Notes
Fixes bugs found since release 5.1.13.
Connector/J's dependence on the
org.apache.commons.logging
package has been
removed.
(Bug #11756133, Bug #48013)
Connector/J's load-balancing functionality only allowed the following events to trigger failover:
Transaction commit/rollback
CommunicationExceptions
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)
The CallableStatementRegression
test suite
failed with a Null Pointer Exception because the
OUT
parameter in the
I__S.PARAMETERS
table had no name, that is
COLUMN_NAME
had 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
characterEncoding=utf8
and set
useUnicode=true
in 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
characterEncoding
has 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)
Using the useOldUTF8Behavior
parameter failed
to set the connection character set to latin1
as required.
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
useOldUTF8Behavior
was 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,
useOldUTF8Behavior
effectively 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)
(Bug #57022)
When a JDBC client disconnected from a remote server using
Connection.close()
, the TCP connection
remained in the TIME_WAIT
state 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:
Auto-commit state
Transaction isolation state
Current schema/catalog
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.java
when calling an
incorrectly cased function name where no permission to access
mysql.proc
was available.
In addition to catching potential NPEs, a guard against calling
JDBC functions with db_name.proc_name
notation was also added.
(Bug #56305)
Added diagnostic information to SQLException
messages 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
Connection
objects 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)
(Bug #56099)
Connector/J could exit with a “parameter index out of range” error when executing stored procedures. (Bug #55328, Bug #11762701)