Fixes bugs found since release 5.1.12.
Functionality added or changed:
Connector/J did not support
utf8mb4for servers 5.5.2 and newer.Connector/J now auto-detects servers configured with
character_set_server=utf8mb4or treats the Java encodingutf-8passed usingcharacterEncoding=...asutf8mb4in 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
LoadBalancingConnectionProxyandLoadBalanceStrategybehaved differently as to whichSQLExceptions 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
Connectionobject to throw anExceptionwhen the first selected host was unavailable. This happened becauseMySqlIO.createNewIO()could throw anSQLExceptionwith aSQLStateof “08001”, which did not trigger the “try another host” logic in theLoadBalanceStrategyimplementations, so anExceptionwas thrown after having only attempted connecting to a single host. (Bug#52231)In the file
DatabaseMetadata.java, the functionprivate void getCallStmtParameterTypesfailed 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_CATwas hardcoded in the code toNULL. In the case wherenullcatalogmeanscurrentwastrue, 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,nullcatalogmeanscurrentwas set tofalsethen a crash resulted.Connector/J has been changed so that when
NULLis passed asPARAM_CATit will not crash whennullcatalogmeanscurrentisfalse, but rather iterate all catalogs in search of stored procedures. This means thatPARAM_CATis no longer hardcoded toNULL(see Bug#51904). (Bug#51912)A load balanced
Connectionobject 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 aSQLExceptionif the server became unavailable during a rollback. The errant code only rethrew whenignoreNonTxTableswas true and the exception did not have the error code 1196,SQLError.ER_WARNING_NOT_COMPLETE_ROLLBACK. (Bug#51776)When the
allowMultiQueriesconnection 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
StatementInterceptorwas used and an alternateResultSetwas returned frompreProcess(), the original statement was still executed. (Bug#51666)Objects created by
ConnectionImpl, such as prepared statements, hold a reference to theConnectionImplthat 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 thoughloadBalanceStrategywas set to a value ofrandom, and multiple hosts were specified. (Bug#51266)An unexpected exception when trying to register
OUTparameters inCallableStatement.Sometimes Connector/J was not able to register
OUTparameters forCallableStatements. (Bug#43576)