Fixes bugs found since release 5.1.12.
Functionality added or changed:
Connector/J did not support
utf8mb4
for servers 5.5.2 and newer.Connector/J now auto-detects servers configured with
character_set_server=utf8mb4
or treats the Java encodingutf-8
passed usingcharacterEncoding=...
asutf8mb4
in theSET NAMES=
calls it makes when establishing the connection. (Bug#54175)
Bugs fixed:
The method
unSafeStatementInterceptors()
contained an erroneous line of code, which resulted in the interceptor being called, but the result being thrown away. (Bug#53041)There was a performance regression of roughly 25% between r906 and r907, which appeared to be caused by pushing the Proxy down to the I/O layer. (Bug#52534)
Logic in implementations of
LoadBalancingConnectionProxy
andLoadBalanceStrategy
behaved differently as to whichSQLException
s trigger failover to a new host. The former looked at the first two characters of the SQLState:if (sqlState.startsWith("08")) ...
The latter used a different test:
if (sqlEx instanceof CommunicationsException || "08S01".equals(sqlEx.getSQLState())) { ...
This meant it was possible for a new
Connection
object to throw anException
when the first selected host was unavailable. This happened becauseMySqlIO.createNewIO()
could throw anSQLException
with aSQLState
of “08001”, which did not trigger the “try another host” logic in theLoadBalanceStrategy
implementations, so anException
was thrown after having only attempted connecting to a single host. (Bug#52231)In the file
DatabaseMetadata.java
, the functionprivate void getCallStmtParameterTypes
failed if the parameter was defined over more than one line by using the '\n' character. (Bug#52167)The catalog parameter,
PARAM_CAT
, was not correctly processed when calling for metadata withgetMetaData()
on stored procedures. This was becausePARAM_CAT
was hardcoded in the code toNULL
. In the case wherenullcatalogmeanscurrent
wastrue
, which is its default value, a crash did not occur, but the metadata returned was for the stored procedures from the catalog currently attached to. If, however,nullcatalogmeanscurrent
was set tofalse
then a crash resulted.Connector/J has been changed so that when
NULL
is passed asPARAM_CAT
it will not crash whennullcatalogmeanscurrent
isfalse
, but rather iterate all catalogs in search of stored procedures. This means thatPARAM_CAT
is no longer hardcoded toNULL
(see Bug#51904). (Bug#51912)A load balanced
Connection
object with multiple open underlying physical connections rebalanced oncommit()
,rollback()
, or on a communication exception, without validating the existing connection. This caused a problem when there was no pinging of the physical connections, using queries starting with “/* ping */”, to ensure they remained active. This meant that calls toConnection.commit()
could throw aSQLException
. This did not occur when the transaction was actually committed; it occurred when the new connection was chosen and the driver attempted to set the auto-commit or transaction isolation state on the newly chosen physical connection. (Bug#51783)The
rollback()
method could fail to rethrow aSQLException
if the server became unavailable during a rollback. The errant code only rethrew whenignoreNonTxTables
was true and the exception did not have the error code 1196,SQLError.ER_WARNING_NOT_COMPLETE_ROLLBACK
. (Bug#51776)When the
allowMultiQueries
connection string option was set totrue
, a call toStatement.executeBatch()
scanned the query for escape codes, even thoughsetEscapeProcessing(false)
had been called previously. (Bug#51704)When a
StatementInterceptor
was used and an alternateResultSet
was returned frompreProcess()
, the original statement was still executed. (Bug#51666)Objects created by
ConnectionImpl
, such as prepared statements, hold a reference to theConnectionImpl
that created them. However, when the load balancer picked a new connection, it did not update the reference contained in, for example, thePreparedStatement
. This resulted in inserts and updates being directed to invalid connections, while commits were directed to the new connection. This resulted in silent data loss. (Bug#51643)jdbc:mysql:loadbalance://
would connect to the same host, even thoughloadBalanceStrategy
was set to a value ofrandom
, and multiple hosts were specified. (Bug#51266)An unexpected exception when trying to register
OUT
parameters inCallableStatement
.Sometimes Connector/J was not able to register
OUT
parameters forCallableStatements
. (Bug#43576)