MySQL Connector/J Changelog

What's new in MySQL Connector/J 5.1.40

Oct 19, 2016
  • FUNCTIONALITY ADDED OR CHANGED:
  • A very old workaround for Bug#36326 (fixed in release 5.1.32) has been removed, so Connector/J can now use local transaction states when the MySQL server has query cache enabled. (Bug #19974685)
  • Added support for the error codes of two MySQL server errors, ER_XA_RBTIMEOUT and ER_XA_RBDEADLOCK. (Bug #13702433, Bug #64188)
  • BUGS FIXED:
  • In certain cases, the exception interceptor was being triggered twice in the internal SQLException factory method. Also, if the exception interceptor returned an exception with the cause already initialized, the same factory method would fail to initialize the cause again, and the real cause for the exception remained uncaptured. (Bug #23743956)
  • Continuing to use a Fabric connection after one of the slaves was removed might result in a ConcurrentModificationException. This happened because the list of slave hosts managed by Connector/J was being traversed and modified at the same time as the replication topology was changed. This patch fixes the issue by having Connector/J use a slave host list that is safe to be modified. (Bug #23738636)
  • When the connection property useCursorFetch was “true” and updatable result sets were used, executeQuery() failed for JSON data with an SQLException: Unknown type. It was because the data decoding routine for updatable JSON data was missing from Connector/J, and it has now been implemented. (Bug #23197238)
  • The FabricMySQLConnectionProxy method nativeSQL() always returned null. The method is now properly implemented. (Bug #23103408, Bug #81072)
  • In a Fabric setup, getMetaData().supportsMixedCaseIdentifiers() always returned “true,” even if lower_case_table_names was set to “1” on the servers. This was because FabricMySQLConnectionProxy.lowerCaseTableNames() was not implemented properly. With this fix, the function now returns the proper value for the current active connection, so that getMetaData().supportsMixedCaseIdentifiers() also returns the correct value.
  • Users are reminded that in a Fabric setup, lower_case_table_names, as well as all other settings, should be configured the same way for all servers in the Fabric server group. (Bug #23103406, Bug #81056)
  • A memory leakage occurred when the connection properties cachePrepStmts and useServerPrepStmts were both set to be true and server-side prepared statements were set as non-poolable, which resulted in the prepared statement being not closable by the client, and the number of prepared statements then kept on increasing.
  • When the memory leakage described above occurred, it did not make Connector/J fail, as Connector/J switched to using client-side prepared statements when the maximum number of prepared statements was reached. However, when rewriteBatchedStatements was also set to true, the switch to client-side prepared statements did not occur, and Connector/J threw the MySQLSyntaxErrorException (“Can't create more than max_prepared_stmt_count statements”) when the client wanted to create more prepared statements than allowed.
  • This fix corrected the way prepared statements are handled in order to avoid both of the problems described above. (Bug #22954007, Bug #80615)
  • ResultSet.getString() sometimes returned garbled data for columns of the JSON data type. This was because JSON data was binary encoded by MySQL using the utf8mb4 character set, but decoded by Connector/J using the ISO-8859-1 character set. This patch fixes the decoding for JSON data. Thanks to Dong Song Ling for contributing to the fix. (Bug #22891845, Bug #80631)
  • When working with MySQL Fabric, Connector/J hung when the Fabric node was down. With this fix, when the Fabric node is down, all active connections continue to work based on the cached information on the server group and the sharding setup, although no new connections can be established. (Bug #22750465)
  • When Connector/J retrieved the value of a BIT column as an integer using, for example, getInt() or getLong(), it returned a wrong value if the BIT value happened to be equivalent to the decimal value of some ASCII digit. This was because Connector/J attempted to parse the value as a string-encoded integer; thus, for example, the BIT value “110001” (decimal 49 in binary) was interpreted as the string “1” (whose ASCII value in decimal is 49), so the numerical value of “1” was returned. This fix corrected the parsing behavior of Connector/J on BIT values, so they are always interpreted as binary coded. (Bug #21938551, Bug #78685)
  • Connector/J could not parse the host name and port number from connection URLS staring with the word “address,” resulting in an UnknownHostException. This was because the URLs were being interpreted incorrectly as using the alternate URL format, which starts with “address=....” This patch fixes the parser for proper interpretation of the URL in the situation. (Bug #21389278, Bug #77649)
  • When the connection property useLocalTransactionState was set to “true” and autocommit was set to “false” on the server, if any exception was thrown, any further calls for rollback() or commit() were not sent to the server. It was because when there was an exception while executing a query, Connector/J lost the information regarding the server's transaction state. This patch fixes this issue by preserving the previous transaction state for the current connection when any exception is thrown. (Bug #20212882, Bug #75209)
  • An invalid connection URL caused Connector/J to throw a NullPointerException. With this fix, an SQLException is thrown instead in the situation. (Bug #18759269, Bug #72632)
  • When a very large amount of compressed data is transmitted from the server to the client and under very special circumstances, a CommunicationsException might occur. It happened when a single compressed packet from the server was not big enough to provide an entire uncompressed packet to the client side. With this fix, Connector/J reads as many compressed packets as necessary to fill the size of the uncompressed packet that was being requested. Thanks to Ryosuke Yamazaki for contributing to the fix. (Bug #11756431, Bug #48346)

New in MySQL Connector/J 5.1.39 (May 9, 2016)

  • Functionality Added or Changed:
  • For MySQL server 5.7.5 and later, the EOF packet in the MySQL server/client protocol has been deprecated and replaced by the OK packet. The change is now supported by Connector/J. (Bug #23212347)
  • Bugs Fixed:
  • Connector/J hung, returned a NullPointerException, or returned an incorrect exception when using result sets with the properties TYPE_FORWARD_ONLY and CONCUR_UPDATABLE. It was due to an inaccurate check for the cursor for the result set. This fix makes sure Connector/J checks accurately on whether a cursor has been requested, both when executing a statement and fetching its results. (Bug #23201930)
  • When using server-side prepared statements with profileSQL=true and useInformationSchema=true, an SQLException (“ ResultSet is from UPDATE. No Data”) occurred when the client tried to advance to the next row in the result set. This was due to a failure of an internal query for metadata, which is now prevented by this fix. (Bug #23188498)
  • LoadBalanceConnectionGroupManager.removeHost() was not removing hosts as expected. This fix tries to ensure that host removals will be successful under different situations. (Bug #22848249)
  • References: See also: Bug #22678872.
  • For connections with useCursorFetch=true and fetch size set with defaultFetchSize or setFetchSize, if data from a TIME and a BLOB data column was selected together, corrupted value for the TIME data was returned. (Bug #22833410, Bug #80522)
  • For a load-balanced connection, an ArrayIndexOutOfBoundsException was thrown when ConnectionGroupManager.removeHost() was called. It was due to an error in LoadBalancedConnectionProxy.removeHost(), which has now been fixed. (Bug #22730682)
  • A Fabric connection threw a NullPointerException when all hosts have been removed from its host list, or when the internal load-balanced connection became null due to inconsistency of the replication connection. This fix adds to Connector/J the abilities to handle those situations. Also, a new connection property, loadBalanceHostRemovalGracePeriod, has been introduced, which sets the grace period for waiting to remove the currently active host from a load-balanced connection. See the entry for the new property in Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J for details. (Bug #22678872)
  • References: See also: Bug #22848249.
  • FabricMySQLDataSource.getConnection() threw a null pointer exception when a master failover took place. (Bug #22598938)
  • The OSGi manifest file in the Connector/J JAR file did not expose the MySQL Fabric packages, so the Fabric-related classes could not be resolved even though they were present in the JAR file. (Bug #22385172)
  • With some Tomcat web applications, when Connector/J connects to the server with useLegacyDatetimeCode=false without setting serverTimeZone, a NullPointerException was returned. This was because the timezone property file for Connector/J was loaded by the bootstrap class loader, which did not know the location of the property file and thus failed to load it. This fix avoids the problem by making Connector/J use the same class loader for both the property file and the Connector/J classes. (Bug #22353759, Bug #79343)
  • When using JDBC 4.2 and with the connection property cachePrepStmts set to “true,” after a prepared statement had been cached, rerunning the SQL statement resulted in a pre-JDBC 4.2 PreparedStatement object being instantiated. This fix prevents the problem by having the PreparedStatement instantiated by a factory instead of a constructor method. (Bug #22352812, Bug #79598)
  • At every connection, Connector/J got the sql_mode variable from the server and tried to parse it as a number; because sql_mode is not a number (except for very old versions of MySQL), an NumberFormatException was always thrown and then caught by the code. This fix refactored the code to avoid the unnecessary throwing and catching of the error. (Bug #21181466, Bug #77171)
  • When inserting multiple timestamp values into a table with useLegacyDatetimeCode=false and useCursorFetch=true, after a null value had been inserted, further inserts could not change a timestamp's value. This fix makes sure the binding of the value is reset before a new insert takes place. (Bug #20685487, Bug #75956)
  • The exception message in CallableStatement() for incorrect output parameter registration gave little detail and the wrong error code. (Bug #18068303, Bug #71131)
  • Calling getTimestamp() on a timestamp column resulted in a java.sql.SQLException (“Cannot convert value ... to TIMESTAMP”). That was due to the missing metadata for each row in the ResultSet. This fix ensures that the metadata is no longer missing. (Bug #16738378, Bug #56479)
  • On very fast servers with other third-party components accessing the data, a ConcurrentModificationException was sometimes thrown. This fix prevents the exception by adding a synchronization to ConnectionImpl.closeAllOpenStatements(), and by refactoring part of the code inside the method. (Bug #16736619, Bug #59462)

New in MySQL Connector/J 5.1.38 (Feb 15, 2016)

  • Functionality Added or Changed:
  • When connecting to a MySQL server 5.7 instance that supports TLS, Connector/J now prefers a TLS over a plain TCP connection. (Bug #21947042)
  • Two new connection properties, allowSlaveDownConnections and readFromMasterWhenNoSlaves, have been introduced for configuring replication-aware connections. See Configuring Master/Slave Replication with Connector/J and the entries for the new properties in Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J for details. (Bug #21286268)
  • Bugs Fixed:
  • In a Fabric environment, a ClassCastException resulted when a stored procedure was called with an INOUT parameter. This was because in this situation, what was being cast was a proxied version of the object. This fix extracts the underlying object from its proxy, allowing it to be cast to the implementing class. (Bug #22096981)
  • getTypeInfo() erroneously returned a PRECISION value of “255” instead of “65535” for the data type VARBINARY. (Bug #21978216)
  • A deadlock was observed when in the same server group, two concurrent threads were using different Fabric connections, and one executed a failover procedure while the other simultaneously called a method that acquired a lock on the underlying replication connection instance monitor. This fix revised the locking mechanism of replication connections, in order to prevent the observed deadlocks. (Bug #21966391, Bug #21934573, Bug #78710)
  • State information of a Fabric group was not updated by Connector/J after a local cache's Time to Live (TTL) expired, which resulted in the client not recognizing any topology changes happening to the group like a master failover, a server rejoining, and so on. (Bug #21296840, Bug #17910835)
  • Connector/J threw an AbstractMethodError when a JDBC 4 functionality (for example, createBlob()) was used on a replication-aware connection. This has been fixed by putting replication connections under the multi-host connection proxy structure that Connector/J has been using for load-balanced and fail-over connections. (Bug #11763419)
  • After the initial call of Connection.setReadOnly() following the creation of a replication-aware connection, subsequent calls of Connection.setReadOnly() could not change the nature of the connection. This has been fixed by putting replication connections under the multi-host connection proxy structure that Connector/J has been using for load-balanced and fail-over connections. (Bug #11763401)

New in MySQL Connector/J 5.1.37 (Oct 28, 2015)

  • A maintenance release of the production 5.1 branch. It is suitable for use with MySQL server versions 5.5, 5.6, and 5.7. It is also the first release of MySQL Connector/J to support the Java Database Connectivity (JDBC) 4.2 API.
  • Functionality Added or Changed:
  • methodCompressedInputStream.getNextPacketFromServer() has been refactored to reduce memory use and garbage collection efforts caused by the use of the inflater. (Bug #21648826, Bug #78106)
  • The code for executing a REPLACE statement when rewriteBatchedStatements=true has been refactored by putting multiple batched statements into a single query, making it work more like an INSERT statement. This increases the efficiency for running REPLACE statements. Thanks to Jie Han for contributing the code. (Bug #21429909, Bug #77681)
  • A new connection property, sendFractionalSeconds=true|false, has been introduced. It controls whether fractional seconds in timestamps are to be truncated on the client side or to be sent to the server side for truncation there. See the entry for the new property in Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J for details. Thanks to Kwon Nam Son for contributing the code. (Bug #21304726, Bug #77449)
  • Connector/J now supports the JSON data type, which has been supported by the MySQL server since release 5.7.8.
  • A new connection property, enableEscapeProcessing, has been introduced for supporting JDBC 4.2. It sets the default escape processing behavior for Statement objects. See the entry for the new property in Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J for details.
  • Bugs Fixed:
  • A ClassCastException resulted for a Fabric connection when rewriteBatchedStatements was “true” and a batch update was rewritten. (Bug #21876798)
  • A number of regression tests in the testsuite failed when they were run against MySQL 5.7, because the NO_AUTO_CREATE_USER SQL mode had become the default behavior of the server since MySQL 5.7.7, making some GRANT statements in the test fail when a new user had to be created. With this fix, CREATE USER statements have been added to the regressions tests when needed, to prevent the test failures. (Bug #21697684, Bug #78225)
  • Connecting to MySQL 5.0 and 5.1 using Connector/J 5.1.36 resulted in an SQLException, with a complaint for an “Unknown system variable 'language'”. (Bug #21415165, Bug #77665)
  • The IS_GENERATEDCOLUMN field was empty in the result returned by DatabaseMetaData.getColumns(). This fix corrects the field so that it contains a YES or NO according to whether the column is generated or not. (Bug #20969312, Bug #76859)
  • getTypeInfo() returned an incorrect PRECISION value of “255” for the data type of VARCHAR. The return value has been corrected to “65535.” (Bug #20675539, Bug #76187)
  • When a connection is forcefully closed with abortInternal() in the ConnectionImpl class, a null point exception sometimes resulted. This is now avoided by putting the associated this.io.releaseResources() call inside a try block, so that the exception, unavoidable due to a race condition, can be properly caught and ignored. (Bug #20536592, Bug #75849)
  • If the MySQL server's default authentication method was SHA256 but neither one of the Connector/J connection properties allowPublicKeyRetrieval and serverRSAPublicKeyFile was set, the authentication failed with a TransientConnectionException, complaining that the public key could not be retrieved. With this fix, authentication continues in the situation, allowing other enabled authentication methods to be tried. (Bug #20433047, Bug #75670)
  • When a lock wait timeout occurred, an SQLException was thrown while an SQLTransientException should be thrown instead. It was due to a wrong SQLState number used in the code, which has now been fixed. (Bug #16634180)
  • When the time zone on the MySQL server was configured to “GMT” but the client was in a different time zone, Connector/J would make wrong adjustments for event timestamps when working with the server. (Bug #11758179, Bug #50348)

New in MySQL Connector/J 5.1.35 (May 21, 2015)

  • FUNCTIONALITY ADDED OR CHANGED:
  • The failover support by Connector/J has been refactored to be implemented independently of Connector/J's load-balancing feature. This resolves a number of issues including, for example, (1) a failover being triggered inadvertently, (2) a failover process kept trying to connect to an unavailable server (while there was an available one), and (3) the number of active connections kept growing until Connector/J threw an exception when there were successive failovers within the same connection. (The issues are regressions of Bug #75168.) (Bug #20533907, Bug #75885)
  • Connector/J now exposes the PreparedStatment.ParseInfo class for external usage, with no capture of the connection, which allows global, highly-concurrent parse caches to be implemented.
  • A number of new configuration properties have been introduced:
  • enabledSSLCipherSuites: For setting the enabled cipher suites used by JSSE. This configuration property needs to be set when using Java 7 or lower or MySQL Server Community edition version 5.7.6 or higher.
  • readOnlyPropagatesToServer: For controlling the implicit propagation of the read-only transaction access mode to the server, which affects optimization for InnoDB read-only transactions.
  • noTimezoneConversionForDateType and cacheDefaultTimezone: For improving Connector/J's time zone support; see the changelog entry for Bug #18028319/Bug #71084 below for details.
  • BUGS FIXED:
  • Issues with a number of the regression tests in the Connector/J test suite caused them to fail when they were run against MySQL 5.7.6. Those tests have now been fixed. (Bug #20606107)
  • Calling the function Clob.setString() with valid input resulted in a string index out of bounds exception. (Bug #20453712)
  • Calling the function Clob.position() resulted in an exception, because the function passed the wrong index value to the getSubString() function. (Bug #20453712)
  • When in streaming mode, if Connector/J encountered an exception while reading from the stream, a subsequent call to the close() method of the result set would put the thread into a blocking state, from which it would not exit. With this fix, the result set can now be properly closed when, due to an error, there is no more data to be loaded from the stream. (Bug #20272931, Bug #75309)
  • The setTimestamp method failed in a Fabric connection with a null pointer exception. It was because the implementation for the getCalendarInstanceForSessionOrNew method was missing, which has been added by this fix to Connector/J. (Bug #20217686, Bug #75080)
  • When using JDBC 4 features of Connector/J 5.1 with JDK 6 and above, custom implementations of the interface LoadBalanceExceptionChecker failed to work. This was because most of the JDBC 4-specific classes of Connector/J do not implement a JDBC interface directly, but extend other JDBC 3 classes instead, so that the LoadBalancingConnectionProxy.isInterfaceJdbc() check did not work. This fix makes the checking work by extending its search to include also the super classes. (Bug #20204783, Bug #75168)
  • The readRemainingMultiPackets method in the MysqlIO class returned incorrect results when a row was larger than 16MB in size. This fix corrects the wrong type conversion occurred during the calculation, which caused the problem. (Bug #20112694, Bug #74998)
  • Calling getString() after rs.relative() had been called with an argument smaller than “-1” resulted in a null pointer exception, because rs.relative() could not handle the argument properly. (Bug #19536760)
  • All occurrences of the StringBuffer class in the Connector/J code has been replaced with the StringBuilder class, in order to improve code performance. (Bug #19465516, Bug #73595)
  • Quoted identifiers in some SQL statements were not properly escaped. (Bug #18925727)
  • A java.sql.date value was stored incorrectly on the server and also returned incorrectly if the client and the server were in different time zones when useLegacyDatetimeCode=false or useTimezone=true. This was due to the time-zone conversion performed by Connector/J on the SQL DATE type. To avoid the issue, a new property noTimezoneConversionForDateType has been created for Connector/J, which is set to “true” by default, preventing Connector/J to perform the kind of time-zone conversion that caused this bug. In addition, another new property cacheDefaultTimezone has been created: when it is set to “true” (by default), Connector/J caches the time zone first obtained from the client and uses it throughout the time the application is running. When it is set to “false,” Connector/J becomes aware of time zone changes in the client at runtime that are initiated by calling java.util.TimeZone.setDefault(zone). (Bug #18028319, Bug #71084)
  • A deadlock occurred when concurrent prepared statements making use of timestamp objects were executed in a single connection. To avoid this, the locking mechanism involved has been changed, so that the calendar object for the session is only locked when it is actually being used. (Bug #15936413, Bug #67760)
  • There was an unnecessary call of targetCalendar.setTime() in the newSetTimestampInternal() method of the PreparedStatement.java class, which modified the user-supplied Calendar object and might cause side effects for the client application. The unnecessary call has now been eliminated by the fix put in for Bug #18028319/Bug #71084. (Bug #11761585, Bug #54095)

New in MySQL Connector/J 5.1.33 (Sep 26, 2014)

  • Bugs Fixed:
  • Many parameters specified with options when making an Ant build of Connector/J from source (for example, com.mysql.jdbc.testsuite.url.sha256default) were not set as system properties and thus were not available for use in the JUnit tests in the testsuite. With this fix, all com.mysql.jdbc.test.* and com.mysql.jdbc.testsuite.* parameters are forwarded to the JUnit tests. (Bug #19505524)
  • XA connections failed with a class cast exception for a load-balanced configuration with pinGlobalTxToPhysicalConnection=true. This was because some XA-related classes used com.mysql.jdbc.ConnectionImpl in method parameters during calls. This fix makes the classes use com.mysql.jdbc.Connection instead in those cases. (Bug #19450418, Bug #73594)
  • The 4-byte UTF8 (utfbmb4) character encoding could not be used with Connector/J when the server collation was set to anything other than the default value (utf8mb4_general_ci). This fix makes Connector/J detect and set the proper character mapping for any utfmb4 collation. (Bug #19479242, Bug #73663)
  • changeUser() calls might result in a connection exception (“Got packets out of order”) or a freeze if the useCompression option was set to true. (Bug #19354014, Bug #19443777, Bug #73577)
  • The MANIFEST.MF file for the JAR package of Connector/J included an empty line between the attributes Import-Package and Name, which was interpreted as a mark for the end of the main section of the manifest file. This fix removes the empty line. (Bug #19365473, Bug #73474)
  • The tests testByteStreamInsert and testUseCompress in the Connector/J testsuite failed with the message “Row size too large (> 8126)...” when they were run against the MySQL server version 5.6.20. This is due to a known limitation with the server version, for which innodb_log_file_size has to be set to a value greater than 10 times the largest BLOB data size found in the rows of the tables plus the length of other variable length fields (that is, VARCHAR, VARBINARY, and TEXT type fields) (see the MySQL 5.6.20 changelog for details). This fix adds, for MySQL 5.6.20, a check for innodb_log_file_size to assert that its value is 335544320 or larger and throws an exception if it is not so, asking the user to increase the size of innodb_log_file_size. (Bug #19172037)
  • Using Java 6 or later, running LOAD DATA INFILE with a prepared statement resulted in an IndexOutOfBoundsException. This was a regression introduced by an issue in the patch for Bug #72008, which has now been fixed. (Bug #19171665, Bug #73163)
  • Connector/J failed the test for Bug# 64205 in the testsuite, thus might return a garbled error message for an invalid query when connected to MySQL server 5.5 or later. The failure was a regression introduced by the fix for Bug #18836319, which made the issuing of SET NAMES dependent on the character set difference between the server and the connection. This fix corrects the way by which the error messages are interpreted, so that they will come out right at any stage of a connection. (Bug #19145408)
  • Errors occur when Connector/J mapped Windows time zones to Olson time zones for “Caucasus Standard Time” and “Georgian Standard Time”. This fix corrected and updated all the time-zone mappings in Connector/J using the data from the IANA Time Database v.2014g and the Unicode Common Locale Data Repository (CLDR) v.25. (Bug #17527948, Bug #70436)
  • The test case testsuite.simple.XATest.testRecover failed when run against MySQL servers 5.7.0 to 5.7.4, because Connector/J did not understand the new output format for XA RECVOER that was introduced since MySQL 5.7.0 for fixing Bug #19505524. That fix has recently been reverted in MySQL 5.7.5, so that XA RECOVER output is now, by default, in the old format again. The test case, which runs well with MySQL 5.7.5, is now skipped for server versions 5.7.0-5.7.4. (Bug #17441747)

New in MySQL Connector/J 5.1.32 (Aug 12, 2014)

  • Functionality Added or Changed:
  • Connector/J used to always check every SQL statement in a server-side prepared statement to see whether it contained the ON DUPLICATE KEY UPDATE clause; but because the clause is only used with INSERT statements, the checks are unnecessary for other SQL statements while they reduce the performance of Connector/J. A new, boolean connection property avoidCheckOnDuplicateKeyUpdateInSQL has been added, by which the checks for the ON DUPLICATE KEY UPDATE clause can be disabled. (Bug #18232840, Bug #71672)
  • Connector/J now supports Fabric 1.5. Older versions of Fabric are no longer supported.
  • Bugs Fixed:
  • A bug in the Linux kernel version 3.6 and earlier caused the MysqlIO.clearInputStream() method to enter an endless loop. This fix changes the way the looping condition is evaluated, in order to avoid the problem. (Bug #19022745, Bug #73053)
  • Preparing a call to a stored procedure with Fabric caused a null point exception to be thrown. (Bug #19034681, Bug #73070)
  • Connector/J returned the incorrect return code “0” for a thrown exception when the failure happened in the context of a global XA transaction. With this fix, Connector/J now wraps any unexpected exception in an XAException in that case and returns the error code XAER_RMFAIL. (Bug #18970520, Bug #72890)
  • The test testSha256PasswordPlugin failed when executed against a commercial version of the MySQL server. (Bug #18852682)
  • Connecting to a user on the server created using the sha256_password plugin failed when the password specified by the client was an empty string (or when no password was specified). This fix makes Connector/J allow an empty password in that case, sending it to the server without applying RSA encryption on it. (Bug #18852587)
  • Calling the changeUser method to switch to a user created using the sha256_password plugin would result in a null pointer exception. This was due to the fact that the fromServer buffer was unavailable when changeUser called the sha256_password plugin, and this fix makes the plugin accommodate to that. (Bug #18869381)
  • Trying to use any character sets other than UTF-8 for communications between client programs and the MySQL server caused Connector/J to perform extra queries after the initial connection, resulting in higher latency and overhead for the connection. To prevent extra queries, this fix eliminates the mechanism of setting the character set to values other than “utf-8” by issuing a SET NAME statement to the server, and allows the use of the connection property characterEncoding to set the character set value in Connector/J's response packet during handshake. (Bug #18836319, Bug #72712)
  • A null pointer exception was thrown in isInterfaceJdbc() sometimes when load balancing was used and the application involved runtime instrumentations. (Bug #18691866, Bug #72502)
  • The keys generated by INSERT statements using the ON DUPLICATE KEY UPDATE clause were incorrect when the clause “ON DUPLICATE KEY UPDATE” was not written exactly as so (for example, when spaces or comments were inserted in between the words). (Bug #18344403, Bug #71923)
  • XA connections failed with a class cast exception for a load-balanced configuration with multiple hosts. This was because some XA-related classes used com.mysql.jdbc.ConnectionImpl in method parameters during calls. This fix makes the classes use com.mysql.jdbc.Connection instead in those cases. (Bug #16722757, Bug #62577)
  • The Ant script for building Connector/J from source failed to check the availability of javac and rt.jar from JDK 1.6 before compilation. That caused compilation to fail when the two files weren't available. This fix corrects the step in the build script that checks for those files before compilation. (Bug #11748301, Bug #35829)

New in MySQL Connector/J 5.1.31 (Jun 7, 2014)

  • Functionality Added or Changed:
  • Added support for sha256_password authentication with RSA encryption.
  • Bugs Fixed:
  • The option name gatherPerfMetrics in the fullDebug.properties file was misspelled as gatherPerMetrics. That resulted in the performance metrics not being logged. The name has been corrected in both the file and the Connector/J manual. (Bug #18598665, Bug #72326)
  • The MySQL Fabric driver did not properly propagate exceptions thrown during connection creation using JDBC 4. (Bug #18549472, Bug #72301)
  • In the method MysqlIO.unpackBinaryResultSetRow, an array was created unnecessarily to hold the null bit mask. With this fix, Connector/J avoids the creation of the array by making use of the data that is still variable in the original buffer object. (Bug #18403456, Bug #72023)
  • When trying to get an integer from a column value that was not a number, instead of a NumberFormatException , an ArrayIndexOutOfBoundsException was thrown instead due to an off-by-one error. This fix corrects the stop condition for trimming spaces in the beginning of byte buffers in the getShort(), getInt(), and getLong() methods in the StringUtils class. (Bug #18402873, Bug #72000)
  • In the method PreparedStatement.ParseInfo, a character array was created unnecessarily out of a string object. This fix removed the unnecessary instantiation of the array. (Bug #18403199, Bug #72006)
  • The StringUtils.getBytes methods have been refactored to avoid unnecessary creations of string objects for encoding character arrays into bytes. Also, unneeded StringBuffers are replaced by StringBuiders. (Bug #18389973, Bug #72008)
  • When exception interceptors were used, the init() method was called twice for each exception interceptor, once by Util.loadExtensions() and again by ConnectionImpl.ExceptionInterceptorChain.init(). This fix eliminates the calls by ExceptionInterceptorChain.init(). (Bug #18318197, Bug #71850)
  • After a non-SSL socket had been transformed into an SSL socket, Connection was still keeping its reference to the wrapped, non-SSL socket, failing to recognize that the type of connection had been changed. This fix creates a new StandardSSLSocketFactory class, which implements SocketFactory and wraps the initial SocketFactory.afterHandshake() method. MysqlIO.socketFactory was replaced after the socket transformation, so that afterHandshake() is performed on the old factory but returns the new socket. (Bug #18260918, Bug #71753)
  • When rewriteBatchedStatements=true and useAffectedRows=true were set, executeBatch() returned the number of affected rows as given by the server, which was not a reliable value unless it was a “0”. That behavior was due to the fix for Bug#68562, which was implemented in Connector/J 5.1.27 (see the changelog for the release), and has been breaking a number of applications that use Connector/J. In this new fix, Connector/J returns Statement.SUCCESS_NO_INFO as a result for each statement in the batch as long as there are more than one batched statement and the returned value for the affected rows from the server is greater than “0”. Connector/J returns a “0” otherwise, which indicates that no rows have been affected. (Bug #18009254, Bug #61213)
  • If profileSQL was enabled, a memory leak would occur after a connection was lost and continuous attempts were made to reconnect. It was because ProfilerEventHandlerFactory kept a map in which dead connections kept on accumulating. This fix refactors the ProfilerEventHandlerFactory and eliminates that map. (Bug #16737192, Bug #55680)
  • When useCursorFetch was set to true, Connector/J would attempt to send XA commands as server prepared statements, which were unsupported, and the commands would have to be resent as plain statements. This fix stops Connector/J from sending XA commands as server prepared statements. (Bug #16708231, Bug #67803)
  • When closing a server-prepared statement twice and cachePrepStmts=true, the second call closed the statement as expected. However, if a call of Connection.prepareStatement() was made again with exactly same SQL string, Connector/J obtained the closed statement from the cache and failed by throwing an exception. With this fix, ServerPreparedStatement.close() detects and ignores subsequent close() calls on cached statements that have already been closed. (Bug #16004987, Bug #66947)

New in MySQL Connector/J 5.1.30 (Apr 10, 2014)

  • Functionality Added or Changed:
  • Connector/J now supports MySQL Fabric. See Using Connector/J with MySQL Fabric for details.
  • Bugs Fixed:
  • Replaced a for loop with the System.arraycopy() method for copying array values in the MysqlIO.unpackNativeEncodedColumn() and LoadBalancingConnectionProxy.addHost() methods, in order to improve the two methods' performance. (Bug #18327245, Bug #71861)
  • Avoided the use of an iterator over the list of statement interceptors in the methods MysqlIO.invokeStatementInterceptorsPost() and MysqlIO.invokeStatementInterceptorsPre(), so that Connector/J does not increase the stack size unnecessarily. (Bug #18236388, Bug #71679)
  • Improved on the code for integer-to-hex conversion when building XA commands by avoiding the creation of temporary character arrays, thus enhancing performance. (Bug #18228302, Bug #71621)
  • The Field.getStringFromBytes() method created a useless byte array when using JVM's converter and the encoding defined by the connection. This fix makes the method call StringUtils.toString() using the original buffer instead of creating a temporary byte array for the call. (Bug #18228668, Bug #71623)
  • There were sporadic cases of the key store file being open hundreds of times and causing some "Too many files open" errors. This fix makes sure that in com.mysql.jdbc.ExportControlled and in MysqlIO.sendFileToServer(), the input stream for the key store file is explicitly closed after use. (Bug #18107621, Bug #71432)
  • It was intended that if a previous query on a connection had used the setMaxRows() method, in the next query, Connector/J would not cancel that by setting SQL_SELECT_LIMIT=DEFAULT if the query contained a LIMIT clause. However, in the actual implementation, the maximum row setting was reused in the subsequent query in various situations beyond expectation (for example, when a table name contains the string ìlimitî in it). This fix removes the LIMIT-clause parsing and replaces it by a better way of controlling the maximum rows per session. (Bug #18110320, Bug #71396)
  • When working with MySQL 5.6, calling PreparedStatement.setTimestamp() resulted in a java.lang.StringIndexOutOfBoundsException being thrown if the Timestamp contained a fractional second. This fix corrects the digit truncation performed in the formatNanos() method, which was the cause of the problem. (Bug #18091639)
  • Calling ResultSet.close() on an already closed ResultSet caused an SQLException. While the exception was silently discarded, it did result in performance issues. This fix makes Connector/J comply with the Java specification that when a ResultSet object is already closed, application of the close method on it should be a no-op. (Bug #16722637, Bug #67318)
  • Fixed the problem of the wrong source being provided when the build property com.mysql.jdbc.noCryptoBuild was set.

New in MySQL Connector/J 5.1.29 (Feb 4, 2014)

  • Functionality Added or Changed:
  • Added a new connection property detectCustomCollations=[true|false]. When its value is false (which is the default value), the ConnectionImpl.buildCollationMapping() method, for detecting non-standard character sets or collations, will NOT be called during the instantiation of a connection, thus shortening the time for establishing a connection.
  • The introduction of this new property with the default value of false alters the old default behaviour of calling ConnectionImpl.buildCollationMapping() at each connection. If non-standard character sets or collations might be used, users should set detectCustomCollations=true. (Bug #17874902, Bug #71038)
  • Bugs Fixed:
  • DatabaseMetaData.getKeywords() did not return the latest reserved words as found in MySQL Server's documentation (for example, in Reserved Words). This fix makes the function generate, as per the JDBC API specification, a list of the latest MySQL and SQL standard keywords that are not also SQL92 (or, depending on the JDBC version in use, SQL2003) keywords.

New in MySQL Connector/J 5.1.28 (Dec 23, 2013)

  • Functionality Added or Changed:
  • Added support for live management for replication hosts. This enables users to change replication topographies (for example, adding or removing a host, or promoting a salve to master) without having to restart an application. See Section, 8.3, "Master/Slave Replication with ReplicationConnection," for details. (Bug #70842)
  • Bugs Fixed:
  • A shadow declaration of com.mysql.jdbc.OperationNotSupportedException is removed from com.mysql.jdbc.RowDataDynamic. (Bug #17833137, Bug #70969)
  • An incorrect SQLException subclass was thrown during a query interruption. This fix creates a new, JDBC4-specific version of MySQLQueryInterruptedException, which subclasses MySQLNonTransientException. (Bug #17750877, Bug #70835)
  • When the connection property dontTrackOpenResources=true was used, the result set was closed after a Statement.close() was issued. (Bug #17164058, Bug #69746)
  • A validation is added to check if blobSendChunkSize is negative (which is the case when maxAllowedPacket is set with a value less than or equal to “8203”) when useServerPrepStmts=true. It throws an exception when the validation fails. (Bug #17184082, Bug #69777)
  • The timeout limit set by DriverManager.setLoginTimeout() was not honored during a handshake attempt. This fix adds the DriverManager.setLoginTimeout() control to the function NonRegisteringDriver.connect(): if the defined timeout is reached, the connection creation is cancelled and an exception is thrown. (Bug #17015317, Bug #69579)
  • The method Statement.closeOnCompletion() was not working. (Bug #16691047, Bug #68916)
  • Connector/J's SQL escape sequence processor was confused by multiple backslashes. The EscapeTokenizer has been re-factored to process multiple backslashes properly. (Bug #11759035, Bug #51313)
  • With cacheResultSetMetadata=true, cacheCallableStmts=true, and cachePrepStmts=true, if a stored procedure that returns a result set was called, calling the stored procedure a second time resulted in a null pointer exception being thrown for initializeResultsMetadataFromCache. (Bug #11762713, Bug #55340)

New in MySQL Connector/J 5.1.27 (Nov 5, 2013)

  • Functionality Added or Changed:
  • Added support for EXPLAIN for UPDATE and DELETE. Extended slow query warning with query execution plan for INSERT, REPLACE, UPDATE, and DELETE.
  • Added the flag CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA and support for authentication data up to a length of 264-1 bytes.
  • Bugs Fixed:
  • When attempting to connect to a server using long, multi-byte user name and database name, an Array Index Out Of Bounds Exception was thrown. This fix prevents the problem by increasing the space reserved for those strings. (Bug #17251955)
  • When setting a connection property with a value for blobSendChuckSize, largeRowSizeThreshold, or locatorFetchBufferSize, the suffix “G” was not recognized and caused an error to be thrown. With this fix, Connector/J now supports using “G” or “GB” for gigabyte for the purpose, as well as “KB” for kilobyte and “MB” for megabyte. (Bug #17015673, Bug #69452)
  • When there was an attempt to create a second branch with a duplicate ID on the same MySQL server instance, the XAException.errorCode returned by Connector/J was not equal to XAException.XAER_DUPID. (Bug #16979862, Bug #69506)
  • The SYSTEM TABLE type was handled inconsistently in different methods: DatabaseMetaData.getTableTypes() did not return system tables, and DatabaseMetaData.getTables() did not return all system tables. With this fix, the table types SYSTEM TABLE and SYSTEM VIEW are returned by getTableTypes(), and getTables() now returns tables from the internal schemas mysql and performance_schema as instances of SYSTEM TABLE and tables from information_schema as instances of SYSTEM VIEW. (Bug #16879239, Bug #69290)
  • JDBC authentication failed when there was a null byte in the scramble, because com.mysql.jdbc.MysqlIO.doHandshake only read up to the first null byte when reading in the first eight bytes of the scramble. (Bug #16723048, Bug #62469)
  • When rewriteBatchedStatements=true and useAffectedRows=true were set, executeBatch() did not return the number of affected rows as expected. (Bug #16442951, Bug #68562)
  • Calling ResultSet.absolute(0) caused Connector/J to throw an error. This fix makes ResultSet.absolute(0) behave like ResultSet.beforeFirst(), as required by the JDBC specifications. (Bug #11749136, Bug #38252)
  • The string returned by DatabaseMetaData.getDriverVersion() contains the unexpanded expression “${svn.Revision}” or “${bzr.revision-id}” instead of the actual revision number of Connector/J. (Bug #50538, Bug #11758345)

New in MySQL Connector/J 5.1.26 (Aug 2, 2013)

  • Functionality Added or Changed:
  • Added a toString() method to the PreparedStatementWrapper class to help debug prepared statements. (Bug #42267, Bug #11751418)
  • Bugs Fixed:
  • Connector/J silently ignored calls to ResultSet.updateRow when the cursor was on the insert row. This fix ensures that an SQLException is thrown with those calls, as described in the JDBC specification. (Bug #45757, Bug #11754192)
  • The results returned by the method DatabaseMetaData.getIndexInfo() were not sorted in the order described in the JDBC specification (NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION). (Bug #68098, Bug #16224299)
  • DatabaseMetaData.getColumns() threw an MySQLSyntaxErrorException if the schema contains tables with ANSI quoted names with leading and trailing back quotes (`). When those names were passed as parameters in unquoted form, Connector/J treated them as quoted because of the back quotes, and thus the error. This fix adds the behavior that when the connection property pedantic was set to true, methods like DatabaseMetaData.getColumns() treat all parameters as unquoted. (Bug #65871, Bug #14598704)
  • An out of memory error occured when the compression protocol was enabled with the connection option useCompression=true. This fix stops the memory leak that caused the error by making sure that CompressedInputStream releases its reference to the connection object when the input stream closes. (Bug #68400, Bug #16478043)

New in MySQL Connector/J 5.1.25 (May 3, 2013)

  • Bugs Fixed:
  • The getDriverName() function would return “MySQL-AB JDBC Driver” as the driver name. This fix changes the driver name string to “MySQL Connector Java”. (Bug #16436511)
  • An exception occurred if NULL was passed to a stored procedure INOUT parameter. (Bug #60816, Bug #12800874)
  • The “mysql-connector-java-5.1.24.jar” prepared for maven.org contained the artifact, META-INF/INDEX.LIST, which incorrectly pointed to “mysql-connector-java-5.1.24-bin.jar”.
  • ReplicationConnection.isMasterConnection(), which is intended to check if the current connection is the master connection, would always return “false”. This fix implements logic that returns “true” if the current connection is the master connection. (Bug #68763, Bug #16545334)
  • When using Connector/J in a replication deployment, all of the slave connections would not be pinged.
  • Tomcat would fail to stop abandoned connection cleanup threads. The fix for Bug#65909 introduced the ability to stop daemon threads started by the Connector/J driver but it also cleared references from daemon threads to the parent classloader. When the clearReferencesStopThreads property is set to “true” in context.xml, Tomcat analyzes classloaders to detect and stop lost threads. This fix ensures that abandoned connection cleanup threads retain a reference to the parent classloader. (Bug #68556, Bug #16443387)
  • Producing Connector/J JAR packages in Eclipse using Ant tasks would result in a JAR file without compiled class files. Compile-related tasks in the Ant script would direct compilation targets to the bin directory (for Eclipse compatibility), while JAR related tasks were directed to {buildDir}/${fullProdName}. This fix changes the JAR task reference to ${compiler.output} instead of {buildDir}/${fullProdName}. (Bug #68664, Bug #16486957)

New in MySQL Connector/J 5.1.22 (Oct 1, 2012)

  • Bugs Fixed:
  • Performance: The com.mysql.jdbc.getCharsetNameForIndex() method was made more efficient, resulting in better performance for queries against tables containing many columns with string data types. (Bug #14236302, Bug #65508)
  • The LoadBalancingConnectionProxy.pickNewConnection() method could incorrectly flag the current connection as invalid after testing another connection. The selection process could choose another (potentially offline) host, leading to a “connection is closed” error when trying to use a connection after re-balancing.
  • With profileSQL=true and useNanosForElapsedTime=true specified in the connection URL, query and fetch duration were not reported correctly. The com.mysql.jdbc.MysqlIO.sqlQueryDirect() method always measured times in milliseconds rather than switching between milliseconds and nanoseconds. (Bug #14273046, Bug #57662)
  • ResultSet objects created by the getGeneratedKeys() method were not being automatically closed, leading to potential memory leaks if the application did not explicitly close the ResultSet objects. (Bug #14192873, Bug #65503)
  • Implemented the getVersionColumns() method, which formerly always returned an empty result set. Now this method returns the timestamp columns that are updated every time a row is changed. (Bug #13636546, Bug #63800)
  • Connecting to a server that used a UCS2 character set would throw an exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??' at line 1
  • Now, Connector/J sets characterEncoding implicitly to UTF-8 when the server character set is UCS2. Because the Connector/J UTF-8 implementation does not cover all UCS-2 characters, note that truncation might occur in some cases. (Bug #11751035, Bug #41752)