MySQL Connector/J 5.1.13
MySQL Connector/J 5.1.13, a maintenance release of the production 5.1 branch has been released. Connector/J is the Type-IV pure-Java JDBC driver for MySQL.
Version 5.1.13 is suitable for use with any MySQL version including MySQL-5.0, MySQL-5.1 or MySQL-5.5.
It is now available in source and binary form from the Connector/J download pages at: http://dev.mysql.com/downloads/connector/j/5.1.html
As always, we recommend that you check the change log http://dev.mysql.com/doc/refman/5.1/en/cj-news.html and “Upgrading” sections http://dev.mysql.com/doc/refman/5.1/en/cj-upgrading.html in the manual before upgrading as well as the “CHANGES” file in the download archive to be aware of changes in behavior that might affect your application.
MySQL Connector/J 5.1.13 includes the following changes targeted at scalability and performance:
- Fixed Bug#51266 – jdbc:mysql:loadbalance:// would stick to the first host in the list in some cases, especially exacerbated if the host was down.
- Replaced URLs of the form jdbc:mysql://host-1,host-2 with a composite of a normal connection and a jdbc:mysql:loadbalance:// connection for more robustness and cleaner code.
- Fixed BUG#51643 – Connections using jdbc:mysql:loadbalance:// would have statements (and prepared statements) that did not have their connections changed upon commit()/rollback(), and thus applications that held statement instances past commit()/rollback() could have data written to or read from un-intended connections.
- Fixed BUG#51783 – Load-balanced connections could throw a SQLException incorrectly on commit() or rollback(). This was not caused by failures in commit or rollback, but rather by the possibility that the newly-selected physical connection was stale. Added logic to catch and retry if this happens, up to the number of hosts specified for load-balancing. Also added new property, loadBalanceValidateConnectionOnSwapServer, which controls whether to explicitly ping the selected host (otherwise, the host is presumed to be up, and will only be noticed if auto-commit or transaction isolation state needs to be set and fails).
- Added loadBalancePingTimeout property to allow a specific timeout to be set for each ping executed against the servers. This ping is executed when the physical connections are rebalanced (commit/rollback or communication exception), or when a query starting with (exactly) “/* ping */” is executed. The latter causes each open underlying physical connection to be pinged.
- Fixed BUG#51776 – Connection.rollback() could swallow exceptions incorrectly.
- Fixed BUG#52231 – Differences in definitions of which SQLExceptions trigger a failover event could result in failure to try more than a single host in certain situations.
- Fixed BUG#52534 – Performance regression using load-balanced connection.
- More aggressively purge the statement timeout timers after they’ve been cancelled to trade time for memory. This purge only happens if statement timeouts are in use.
- Added management of running load-balanced connections. Statistics can be obtained, and hosts added/dropped via com.mysql.jdbc.ConnectionGroupManager or the JMX implementation. This functionality is enabled by setting the new parameter “loadBalanceConnectionGroup” to the name of the logical grouping of connections.
All load-balanced connections sharing the same loadBalanceConnectionGroup value, regardless of how the application creates them, will be managed together. To enable JMX-based management, set loadBalanceEnableJMX=true and ensure that remote JMX is enabled in the JRE (eg, use -Dcom.sun.management.jmxremote).
- Added loadBalanceExceptionChecker property, which takes a fully-qualified class name implementing the com.mysql.jdbc.LoadBalancedExceptionChecker interface. This allows custom evaluation of SQLExceptions thrown to determine whether they should trigger failover to an alternate host in load-balanced deployments. The default is com.mysql.jdbc.StandardLoadBalanceExceptionChecker.
- Added two new properties which allow more flexibility in determining which SQLExceptions should trigger failover in a load-balanced deployment. The new “loadBalanceSQLStateFailover” property takes a comma-delimited list of SQLState codes which are compared to the SQLState of the SQLException (matching done with trailing wildcard), while “loadBalanceSQLExceptionSubclassFailover” takes a comma-delimited list of fully-qualified class/interface names, against which the SQLException is checked to determine if it is an instance of any. Matches trigger failover to an alternate host.
- Fixed Bug#51704 – Re-written batched statements don’t honor escape processing flag of their creator.
As well as the following general bug fixes and improvements:
- Fixed BUG#51666 – StatementInterceptors were never “un-safed” after connection establishment, causing interceptors which returned result sets pre/post execution would not work.
- Minor fix in previous patch for Bug#51904. Function ConnectionImpl.setCatalog() was passed quoted argument thus breaking with “…for the right syntax to use near ‘test“’”
- Fix for Bug#51912 – Passing NULL as cat. param to getProcedureColumns with !nullCatalogMeansCurrent
- Fix for Bug#52167 – Can’t parse parameter list with special characters inside
- Fix for Bug#51904 – getProcedureColumns() always returns PROCEDURE_CAT result column as NULL
- Fix for Bug#51712 – Display Size is always 0 for columns returned by getProcedureColumns()
- Fix for Bug#51908 – db variable might have end up unassigned when calling getProcedureColumns()/Functions(). This is a followup on code changes made for Bug#51022.
- Fixed Bug#43576 – Sometimes not able to register OUT parameters for CallableStatements.
- Fixed Bug#54175 – Driver doesn’t support utf8mb4 for servers 5.5.2 and newer. The driver now auto-detects servers configured with character_set_server=utf8mb4 or treats the Java encoding “utf-8″ passed via “characterEncoding=…” as utf8mb4 in the “SET NAMES=” calls it makes when establishing the connection.

