Fixes bugs found since release 5.1.22. Also adds support and test cases for several new features from MySQL Server 5.6.
-
New test cases cover new features from MySQL Server 5.6:
Explicit partition selection syntax.
EXCHANGE PARTITION
syntax.Transportable tablespaces syntax:
LOCK TABLES ... FOR EXPORT
.CREATE TABLE ... DATA DIRECTORY = '/absolute/path/to/directory/'
syntax for InnoDB tables.New
ALTER TABLE
syntax:ALGORITHM
andLOCK
keywords.
-
Added support of password expiration protocol. This introduces a new Boolean connection property
disconnectOnExpiredPasswords
:If
disconnectOnExpiredPasswords=true
and the password has expired, the connection will be rejected by server withErrorCode == 1820
(ER_MUST_CHANGE_PASSWORD
).If
disconnectOnExpiredPasswords=false
, the connection enters “sandbox” mode, where all commands exceptSET PASSWORD = ...
andSET PASSWORD FOR CURRENT_USER() = ...
cause an error to be thrown. The user needs to reconnect though, after setting the password, because Connector/J requires additional information from the server that is not available in the “sandbox” mode.
Static charset/collation maps were updated, particularly for the
ucs2_unicode_ci
andutf8_unicode_ci
collations.Connection.setReadOnly()
will take advantage of server-side support for read-only transactions present in MySQL 5.6 and newer. Calling.isReadOnly()
will incur a round-trip ifuseLocalSessionState
is not enabled.-
The driver now allows the mechanism for caching MySQL server configuration values replaceable at runtime, via the
serverConfigCacheFactory
property. The default is an implementation that is a per-VM concurrent map, keyed by URL. The driver will invalidate cache entries whenSQLException
exceptions that indicate communications errors are thrown (on the assumption that the server has been or is restarting). The driver also invalidates cache entries if the server version that is being connected to differs from the one that was present when the cached values were populated.To replace the default implementation, implement
CacheAdapterFactory<String, Map<String, String>>
, and specify the fully-qualified class name of this implementation for theserverConfigCacheFactory
connection option.
Stack trace used for point-of-origin in log and exception messages caused a Permgen leak when an application was redeployed, because the
WebappClassloader
could not be garbage collected. We no longer store the entire stack trace, only the calling class and method, and only when using the usage advisor or when profiling. (Bug #16097851, Bug #67954)With the connection setting
useCompression=true
, the SQL statementLOAD DATA LOCAL
could cause ajava.net.SocketException
error due to a broken pipe. (Bug #15895369, Bug #11237)The
nativeSQL()
method would always truncate fractional seconds rather than preserving the fractional part in the output string. Now Connector/J checks the server version: it preserves the fractional part for MySQL 5.6.4 and greater, and truncates the fractional part for older versions. (Bug #14748459, Bug #60598)With the new MySQL server password hashing feature enabled, different results could be returned from
ResultSet
andCachedRowSet
. The test suite was modified to not perform comparison ofPASSWORD()
results when the settingold_passwords=2
, because with SHA-256 password hashing enabled, the function return results are nondeterministic. (Bug #14665141)-
The cleanup thread for abandoned connections in the
NonRegisteringDriver
class was refactored to have a static shutdown method. Memory was allocated but never released. If you encountered this leak problem, implement the context listener in your application with theAbandonedConnectionCleanupThread.shutdown()
call in thecontextDestroyed
method. This issue was found in applications running under the Tomcat application server, but it might have also applied to other application servers.For example:
@WebListener public class YourThreadsListener implements ServletContextListener { public void contextDestroyed(ServletContextEvent arg0) { try { AbandonedConnectionCleanupThread.shutdown(); } catch (InterruptedException e) { } } ... }
Note that if container does not support annotations, you add the description to
web.xml
:<listener> <listener-class>user.package.YourThreadsListener</listener-class> </listener>
(Bug #14570236, Bug #65909)
With the connection parameter
rewriteBatchedStatements=true
,ResultSetRow.getTimeFast
could give an incorrect value forTIME
columns containing a fractional part. (Bug #14260352)If a
timestamp
value was passed through prepared statement parameters, fractional-second precision was stripped off, even if the underlying field (such asVARCHAR(255)
) could store the full value. A workaround was to convert the timestamp value to a string when specifying the prepared statement argument, for exampleprepped_stmt.setString(1,time_stamp.toString()
. This was partly fixed in 5.1.19, but that fix did not cover the case with the settinguseLegacyDatetimeCode=true
. (Bug #11750017, Bug #40279, Bug #60584)executeQuery()
inStatement.java
letTRUNCATE TABLE
queries be executed, although that method is supposed to block any request that modifies the database.TRUNCATE TABLE
andRENAME TABLE
are now filtered forexecuteQuery()
. (Bug #11748257, Bug #35653)Compiling Connector/J from source failed when using a non-Sun/Oracle JDK, because the Ant target
compile-testsuite
contained aAppletRegressionTest
that used a Sun-specific class (sun.applet.AppletSecurity
). This fix removes theAppletRegressionTest
and thus the dependence on the Sun class from the build process. (Bug #11745319, Bug #13509)