MySQL Connector/J Changelog

What's new in MySQL Connector/J 8.0.33

Apr 18, 2023
  • Functionality Added or Changed:
  • The JAR library for Connector/J has been renamed to mysql-connector-j.jar since release 8.0.31. Since then, upgrading Connector/J from 8.0.30 or earlier using RPM or DEB packages would change the name of the original .jar file, causing some applications that depend on it to fail. With this fix, RPM and DEB packages for Connector/J create a symbolic link to make the old name /usr/share/java/mysql-connector-java.jar point to the new name /usr/share/java/mysql-connector-j.jar. (For the commercial versions, the symbolic link mentioned has -commercial in it.) (Bug #35018216)
  • Connector/J now supports OCI authentication using an ephemeral key pair. A new connection property, ociConfigProfile, has been introduced for specifying the configuration profile (defined in the OCI configuration file) to be used for authentication. If ociConfigProfile is not specified, the DEFAULT profile is used. See Token-based Authentication for the CLI for more details. (WL #15490)
  • Bugs Fixed:
  • RPM packages for Connector/J 8.0.31 and 8.0.32 failed to upgrade earlier versions of Connector/J. This was due to misconfigurations of the RPM packages, which has been corrected by this fix. (Bug #35110706)
  • Pluggable custom classes provided to Connector/J were initialized even when they were not actually usable. With this fix, these classes are validated against the interface they implement before their static initialization. (Bug #34918989)
  • For Connector/J 8.0.29 or later, client-side prepared statements failed with the error "Incorrect string value" when setCharacterStream() was used, if the JVM's character encoding did not match the target column's character set. It was because, in that case, the character encoding of the JVM was used when sending character streams to the server, which was unable to decode them as they were expected to be encoded with the column's character set. With this fix, the character set specified by either the connection property clobCharacterEncoding or characterEncoding is used instead, for both client-side and server-side prepared statements, which is the expected behavior. (Bug #34558945)
  • When connecting to MySQL Server 5.7 and earlier with Connector/J 8.0.32, Connector/J sometimes hung after the prepare phase of a server-side prepared statement. (Bug #109864, Bug #35034666)
  • References: This issue is a regression of: Bug #33968169.
  • Results returned by the getPrimaryKeys() method of the DatabaseMetadata interface were not sorted by COLUMN_NAME as required by the JDBC specification. (Bug #109808, Bug #35021038)
  • Results returned by the getTypeInfo() method of the DatabaseMetadata interface were not sorted by DATA_TYPE as required by the JDBC specification. (Bug #109807, Bug #35021014)
  • Rewriting of batched statements failed when a closing parenthesis was found within a VALUES clause. It was because QueryInfo failed to parse the prepared statement properly in that case. With this fix, the parser of VALUES clauses is improved, so that Connector/J is now able to recognize rewritability of statements that contain function calls or multiple VALUES lists, and it also handles well the cases when the string "value" is part of a table name, a column name, or a keyword. (Bug #109377, Bug #34900156, Bug #107577, Bug #34325361)
  • Before executing a query with Statement.executeQuery(query), Connector/J checks if the query is going to produce results and rejects it if it cannot. The check wrongly rejected queries that had a WITH clause in which there was no space after the comma between two common table expressions. (Bug #109243, Bug #34852047)
  • When the connection property useLocalTransactionState was set to true, after a number of insert statements were executed and the last one hit a unique constraint check, the transaction could not be rolled back. It was because Connector/J lost track of the transaction statuses of the statements in the case, and this patch corrects the problem. (Bug #109013, Bug #34772608)
  • When both the connection properties useLocalTransactionState and rewriteBatchedStatements were set to true, prepared statements could not be committed. It was because Connector/J lost track of the transaction statuses of the statements created internally to run the rewritten queries, and this patch corrects the problem. (Bug #108643, Bug #34652568)
  • When executing a LOAD DATA LOCAL INFILE statement, the file could not be loaded if a relative path of it was used and the path was not relative to the directory in which the JVM was started. This patch fixes the behavior by resolving the relative path using the Java system property user.dir, which was ignored before in the process. (Bug #77368, Bug #21321849)

New in MySQL Connector/J 8.0.32 (Jan 26, 2023)

  • Functionality Added or Changed:
  • Removed distutils support, which is deprecated as of Python 3.10 and removed in Python 3.12.
  • Adopted type hint enforcement for function and class attributes with mypy; this is compliant with PEP 8 for module mysql.connector. The integration includes a git pre-commit hook for mypy.
  • On Windows, added a kerberos_auth_mode connection option that's set to either "SSPI" (default) or "GSSAPI". This allows choosing between SSPI and GSSAPI at runtime for the authentication_kerberos_client authentication plugin on Windows. Previously, only the SSPI mode was supported on Windows. For general usage information, see Kerberos Pluggable Authentication. This connection is ignored on other platforms, such as Linux, as they only support GSSAPI.
  • Limitation: GSSAPI can't be used with the pure Python implementation on Windows using authentication with a username and password, a limitation with the C library used by the python-gssapi package used by the pure Python implementation of Connector/Python.
  • Bugs Fixed:
  • Using USE_TZ=True in the Django settings would raise this exception: ValueError: Not naive datetime (tzinfo is already set).
  • Removed debug messages that showed authentication data. (Bug #34695103)
  • Updated the protobuf version requirement to version >= 3.11.0, <=3.20.3.
  • Connecting to MariaDB could fail with an unsupported character set because the default MySQL character collection is MySQL 8.0 specific. Now the 5.7 character set is used by default, but is switched to a 8.0 character set if the queried server is version 8.0.
  • Incorrect MySQLCursor.statement values were returned with cursor.execute(query_string, multi=True) under the following conditions: The query string contained two or more queries seperated by a semicolon, and the non-first query used a literal or identifier containing either an odd number of backticks, quotes, or double quotes.
  • On Windows, changed the security support provider (SSP) from Kerberos to Negotiate. Using Negotiate will then select either Kerberos or NTLM as the SSP.
  • On Windows, the Connector/Python MSI did would not detect and install with Python 3.11. The workaround is to use pip install mysql-connector-python instead.
  • When using a prepared cursor, if a datetime column contained 00:00:00 as the time, a Python date object was returned instead of datetime.
  • The MySQLCursor.executemany() method failed to batch insert data since the regular expression (RE) sentinel did not detect batch cases correctly; this meant using the one-on-one insert instead, which led to decreased performance.
  • Added a new init_command connection option; an SQL query that's immediately executed after the connection is established.
  • Russian characters were not handled correctly by the c-ext version's X DevAPI driver. String values are now encoded to their byte string representation before being sent to protobuf.
  • When fetching results from a prepared cursor using the pure Python implementation, it would fail if the VARBINARY column contained bytes that could not be decoded. The bytes are now returned if they cannot be decoded.
  • Fixed multiple reference leaks and removed redundant code.
  • The cursors (both pure and c-ext versions) uses a single SELECT query to retrieve procedure result parameters after a procedure call; but one SET call was used per parameter when setting the input parameters. This was optimized to always use a single SET call for one or multiple parameters.
  • Improved warning handling throughout the connector.
  • Added a new MySQLCursorPreparedDict class option that is similar to MySQLCursorPrepared; the difference is that the former returns a fetched row as a dictionary where column names are used as keys while the latter returns a row as a traditional record (tuple).
  • Enable the use of dictionaries as parameters in prepared statements using the '(param)s' format as placeholders.
  • Using MySQLConverter.escape() on datetime objects raised this error: TypeError: an integer is required. Now it does not attempt to escape values that are not bytes or string types.
  • Not all parameters were added to the INSERT statement when using INSERT IGNORE with cursor.executemany().

New in MySQL Connector/J 8.0.31 (Dec 13, 2022)

  • Functionality Added or Changed:
  • Important Change: To comply with proper naming guidelines, the Maven groupId and artifactId for Connector/J have been changed to the following starting with this release:
  • groupId: com.mysql
  • artifactId: mysql-connector-j
  • The old groupId and artifactId can still be used for linking the Connector/J library, but they will point to a Maven relocation POM, redirecting users to the new coordinates. Please switch to the new coordinates as soon as possible, as the old coordinates could be discontinued anytime without notice. See Installing Connector/J Using Maven.
  • Also, to go with these changes, the .jar library for Connector/J has been renamed to mysql-connector-j-x.y.z for all channels of distribution by Oracle, not just the Maven repository.
  • Before release 8.0.29, Connector/J always interpolated byte arrays as hexadecimal literals when obtaining a prepared statement's string representation by the toString() method. Since 8.0.29, all byte array values were displayed as ** BYTE ARRAY DATA ** when converted to strings. The same is also true for null values.
  • To allow different ways to display byte array data and null values, a new connection property, maxByteArrayAsHex, has been introduced: byte arrays shorter than the value of maxByteArrayAsHex are now shown as hexadecimal literals like before release 8.0.29. Any byte arrays longer than this value are interpolated generically as ** BYTE ARRAY DATA **. (Bug #107222, Bug #34150112)
  • Bugs Fixed:
  • X DevAPI: When parsing a string into a JSON string, some escape character sequences were not parsed properly, causing the Server to throw a com.mysql.cj.exceptions.WrongArgumentException when receiving the JSON value. This fix ensures that escape sequences are handled properly. (Bug #34529014)
  • X DevAPI: When using the modify() method on JSON documents, any backslashes inside a literal to be used for the modification were lost. This fix corrects the mistakes in the expression parser that caused the issue. (Bug #33637993)
  • Executing a PreparedStatment after applying setFetchSize(0) on it caused an ArrayIndexOutOfBoundsException. (Bug #104753, Bug #33286177)
  • Due to some old limitations, when used with Java applets, Connector/J found out the default character set on a system by various workarounds like reading the system property file.encoding, using an OutpuStreamWriter, etc. With this fix, Connector/J now uses Charset.defaultCharset(), the standard method for the purpose. (Bug #67828, Bug #15967406)

New in MySQL Connector/J 8.0.30 (Jul 26, 2022)

  • Functionality Added or Changed:
  • X DevAPI: For document-modifying methods that are chained after modify() and take a document path expression as one of its arguments (that is, set(), unset(), arrayInsert(), arrayAppend()), Connector/J now throws an error when the document path is empty or is a null string. (Bug #34259416)
  • Bugs Fixed:
  • Historically, MySQL Server has used utf8 as an alias for utf8mb3. Since release 8.0.29, utf8mb3 has become a recognized (though deprecated) character set on its own for MySQL Server and to make things consistent, in release 8.0.30, any collations prefixed with utf8_ are now prefixed with utf8mb3_ instead. To go with that change, Connector/J has updated its character set and collation mapping accordingly in this release, and users are encouraged to update to Connector/J 8.0.30 to avoid potential issues when working with MySQL Server 8.0.30 or later. (Bug #34090350)
  • A few links in the CONTRIBUTING.md file in the distribution packages were broken. They have now been fixed or removed. (Bug #34082503)
  • The description for the connection property rewriteBatchedStatements has been corrected, removing the limitation that server-sided prepared statements could not take advantage of the rewrite option. (Bug #34022110)
  • A spelling error has been fixed in the source file for the PropertyDefinitions class. Thanks to Weijie Wu for contributing the fix. (Bug #106779, Bug #33976245)
  • DatabaseMetaData.getTypeInfo always returned false for AUTO_INCREMENT for all data types. With this fix, Connector/J returns the correct value for each data type. Also, the missing types DOUBLE UNSIGNED and DOUBLE PRECISION UNSIGNED have been added to the ResultSet. (Bug #106758, Bug #33973048)
  • Contrary to the the MySQL requirement for comments, Connector/J did not require a whitespace (or a control character such as a newline) after "--" to mark the beginning of a comment within a SQL statement. This fix aligns Connector/J with the MySQL requirement. (Bug #76623, Bug #20856749)

New in MySQL Connector/J 8.0.28 (Apr 26, 2022)

  • Functionality Added or Changed:
  • X DevAPI: A document _id check has been added to the Collection.addOrReplaceOne(id, doc) and Collection.replaceOne(id, doc) methods: If the id supplied as an argument for the functions does not match the _id in doc (the supplied JSON document), the operation fails. (Bug #32770013)
  • Connector/J now supports multifactor authentication for connections to MySQL Servers. Three new connection properties, password1, password2, and password3, have been added for that purpose. See Connecting Using Multifactor Authentication for details.
  • The TLSv1 and TLSv1.1 connection protocols were deprecated in Connector/J 8.0.26 and are now removed in this release. The removed values are considered invalid for use with connection options and session settings. Connections can be made using the more-secure TLSv1.2 and TLSv1.3 protocols. Using TLSv1.3 requires that the server be compiled with OpenSSL 1.1.1 or higher and Connector/J be run with a JVM that supports TLSv1.3 (for example, Oracle Java 8u261 and above).
  • Also, the following connection properties have been renamed:
  • EnabledTLSProtocols renamed to tlsVersions; the original name remains as an alias.
  • EnabledSSLCipherSuites renamed to tlsCiphersuites; the original name remains as an alias.
  • Bugs Fixed:
  • The README file in the Connector/J distribution contained broken links in the Additional Resources section. (Bug #33507321)
  • Storing a java.time.LocalDate object onto the server as a DATE value using a batched PreparedStatement failed with the complaint that java.time.LocalDate could not be cast to java.sql.Date. With this fix, the object is encoded correctly into a DATE value. (Bug #33468860, Bug #105211)
  • ResultSet navigation methods like absolute(), relative(), first(), last(), and so on returned a NullPointerException when they were applied to a non-navigable ResultSet. This was because the methods did not check if the ResultSet really had any rows before trying to navigate it. This patch makes all navigation methods perform the check and throw a proper SQLException when the ResultSet has no rows. (Bug #33461744)
  • Running a PreparedStatement in the form of INSERT INTO ... VALUE ... ON DUPLICATE KEY UPDATE ... VALUES(...) resulted in a StringIndexOutOfBoundsException. It was because Connector/J did not recognize VALUE as an alias for VALUES in an INSERT statement, and mistook the VALUES() function as a VALUES clause for the statement. With this fix, statements like this are parsed properly. (Bug #33425867, Bug #84365)
  • When the connection session's character set was SJIS, BLOB values could not be handled properly by client-side prepared statements. (Bug #33350185)
  • Some Java frameworks prevent changes of the autocommit value on the MySQL Server. When an application tried to change autocommit, the value was changed for the connection Session on the client side, but it failed to change on the server, so the settings became out of sync. With this fix, Connector/J resets autocommit to its original value for the Session under the situation. Thanks to Tingyu Wei for contributing to the fix. (Bug #33054827, Bug #104067)
  • GetWarnings() always sent a SHOW WARNINGS query to the server. With this fix, the query is sent only if there really are warnings to be shown, in order to save resources. (Bug #32089018, Bug #101389)
  • After calling Statement.setQueryTimeout(), when a query timeout was reached, a connection to the server was established to terminate the query, but the connection remained open afterward. With this fix, the new connection is closed after the query termination. (Bug #31189960, Bug #99260)
  • A new session created for executing Statement.cancel() remained open after the Statement had been cancelled. With this fix, the session is closed after the Statement cancellation. (Bug #30355150, Bug #96900)
  • Using the setString() method on an SQLXML object resulted in a NullPointerException. (Bug #25656020, Bug #85223)

New in MySQL Connector/J 8.0.24 (Apr 20, 2021)

  • Functionality Added or Changed:
  • A new connection property, scrollTolerantForwardOnly, has been introduced, which preserved the legacy behavior of Connector/J 8.0.17 and earlier by tolerating backward and absolute cursor movements on result sets of type ResultSet.TYPE_FORWARD_ONLY. This is for maintaining compatibility with legacy code that took advantage of the old behavior. See the description for scrollTolerantForwardOnly for details. (Bug #31747910)
  • Connector/J now supports "userless" authentication for JDBC connections: When the user for the connection is unspecified, Connector/J uses the name of the OS user who runs the application for authentication with the MySQL server. See Connector/J: Obtaining a connection from the DriverManager for more details.
  • Starting from this release, whenever an authentication plugin is explicitly set for the connection property defaultAuthenticationPlugin, the specified plugin takes precedence over the server's default when Connector/J negotiates a plugin with the server. There is no behavioral change for Connector/J if no value is explicitly set for the property, in which case the server's choice of default plugin takes precedence over the implicit default of mysql_native_password for Connector/J. See the description of defaultAuthenticationPlugin for details.
  • In the past, for JDBC connections, when the server closed a session because a client was idling beyond the period specified by the server's wait_timeout system variable, Connector/J returned a generic IO error. Connector/J now relays a clearer error message from the server.
  • X DevAPI: For X Protocol connections, the Server now provides three new kinds of notifications for disconnections:
  • Server shutdown: This is due to a server shutdown. It causes Connector/J to terminate all active and idle sessions connected to the server in the connection pool with the error message "Server shutdown in progress".
  • Connection idle: This is due to the connection idling for longer than the relevant timeout settings. It causes Connector/J to close the current connection with the error message "IO Read error: read_timeout exceeded".
  • Connection killed: This is due to the connection being killed by another client session. It causes Connector/J to close the connection in the current session with the error message “Session was killed".
  • Bugs Fixed:
  • DevAPI: Concurrently getting and closing multiple sessions from the same X DevAPI Client object might result in a ConcurrentModificationException thrown by Connector/J at the closing of a session. (Bug #31699993)
  • DevAPI: Under some specific conditions, when using Deflate as the algorithm for compression of X Protocol connections, Connector/J threw an AssertionFailedException (ASSERTION FAILED: Unknown message type: 57). It was because when a compressed packet was just a few bytes longer than the size of some internal buffer used by a Java InflaterInputStream, the leftover bytes from the inflate procedure were being discarded by Connector/J, causing inflation of subsequent packets to fail. With this fix, no data bytes are discarded, and the inflation works as expected. (Bug #31510398, Bug #99708)
  • When a SecurityManager was in place, connections to a MySQL Server could not be established unless the client had been properly configured to use SASL-based LDAP authentication. It was because the AuthenticationLdapSaslClientPlugin in Connector/J requires a special permission to load the provider MySQLScramShaSasl when a SecurityManager is in place; but since the provider was loaded by a static initializer during initialization for the plugin, the lack of the permission was causing an error and then failures for all connections, even if the plugin was never used or enabled. This fix changes how the provider is loaded: the loading now happens only at the plugin instance's initialization and the initialization was deferred to the time when the plugin is actually needed, so that connections that do not use SASL-based LDAP authentication are unaffected by security settings regarding the plugin. (Bug #32526663, Bug #102188)
  • When using Connector/J 8.0.23, ResultSetMetaData.getColumnClassName() did not return the correct class name corresponding to DATETIME columns. (Bug #32405590, Bug #102321)
  • Creation of an UpdatableResultSet failed with a NullPointerException when it was generated by querying a view with a derived value. (Bug #32338451, Bug #102131)
  • Using getLong() on the CHAR_OCTET_LENGTH column of the ResultSet for DatabaseMetaData.getProcedureColumns() (or getFunctionColumns()) resulted in a NumberOutOfRange exception when the column's value exceeded 232 − 1. With this patch, the value of 232 − 1 is returned in the situation. (Bug #32329915, Bug #102076)
  • Connections to a server could not be established when the user supplied an implementation of the ConnectionPropertiesTransform interface using the connection property propertiesTransform. This was because Connector/J called PropertyKey.PORT.getKeyName() instead of PropertyKey.HOST.getKeyName() for getting the host name, and that has been corrected by this fix. (Bug #32151143, Bug #101596)
  • A NullPointerException was returned when a statement that could not be used as a ServerPreparedStatement was executed and the connection property useUsageAdvisor was set to true. With this fix, a SQLException is returned instead. (Bug #32141210, Bug #101558)
  • Using the setSessionMaxRows() method on a closed connection resulted in a NullPointerException. With this fix, a SQLNonTransientConnectionException is thrown instead, with the error message "No operations allowed after connection closed." (Bug #22508715)
  • Using the setObject() method for a target type of Types.TIME resulted in a SQLException when the value to be set had a fractional part, or when the value did not fit any pattern described in Date and Time Literals. This patch introduced a new logic that can handle fractional parts; also, it performs the conversion according to the patterns of the literals and, when needed, the target data type. (Bug #20391832)

New in MySQL Connector/J 8.0.20 (Jul 13, 2020)

  • Functionality Added or Changed:
  • X DevAPI: Connector/J now supports data compression for X Protocol connections. See Connection Compression Using X DevAPI for details
  • A new method, getElapsedTime(), has been added to the implementation of the Statement interface in Connector/J, to expose the elapsed time for a query. Thanks to Matti Sillanpää for contributing the code. (Bug #30570249, Bug #97714)
  • Bugs Fixed:
  • When a custom Calendar was used in the setDate method for a PreparedStatement, it was being used by subsequent calls of the same method that did not use the same calendar, resulting in the wrong date being set. It was because the SimpleDateFormat object created internally with the custom calendar was cached and reused. With this fix, the object is no longer cached. (Bug #30877755)
  • Setting the connection property clientInfoProvider without using the fully qualified class name for ClientInfoProviderSP caused a NullPointerException. This was due to some wrong exception handling, which has been corrected by this fix. (Bug #30832513)
  • Authentication failed when a client tried to connect to a server that used Windows Authentication Plugin and the Kerberos protocol. It was because the implementation of the NativeAuthenticationProvider class by Connector/J did not interact correctly with a custom-made Kerberos authentication plugin, and this patch fixes the issue. (Bug #30805426)
  • Methods from the ResultSetUtil class are no longer used in Connector/J 8.0.20; the class has therefore been removed. (Bug #30636056)
  • A NullPointerException was returned when the connection had cacheResultSetMetadata=true and a query containing any SET statements was executed. This fix corrects the issue by adding the missing variable assignment, and also a null check. (Bug #30584907, Bug #97757)
  • A DataConversionException was thrown when an application tried to store a string starting with "d." [d was any digit] into a VARCHAR column. It was due to a parsing error in the AbstractNumericValueFactory, which has been fixed by this patch. Thanks to Nick Pollett for contributing the code. (Bug #30570721, Bug #97724)
  • When creating a Statement, the specification for the resultSetType parameter was not honored, so that the ResultSet type was always set to ResultSet.TYPE_FORWARD_ONLY. With this fix, the resultSetType parameter is now honored. Also, type validation has been added so that calling the methods beforeFirst, afterLast, first, last, absolute, relative, or previous results in an exception if the ResultSet type is ResultSet.TYPE_FORWARD_ONLY. (Bug #30474158)
  • When a Calendar was not used, a java.sql.Date value could not always be stored into and then retrieved from a MySQL server consistently. It was because Connector/J always converted a Date value to the server's time zone when storing it on the server as a MySQL DATE; but since a MySQL DATE does not have any time value, the hour, minute, and second parts of the original date was effectively lost. If the converted value is one day ahead of or behind the original value, when the value was retrieved through Connector/J and converted back to the local time zone, there was no time value for adjusting the date back to its original value, resulting in a one-day error. With this fix, any Date value is converted to MySQL DATE value using the JVM's time zone, so that the value is always consistent when being stored and then read back
  • Also, the cacheDefaultTimezone connection property, previously removed from Connector/J 8.0, has now been restored so that when it is set to false, Connector/J becomes aware of the time zone changes of the JVM during runtime and converts dates with the updated time zone. (Bug #28125069, Bug #91112)

New in MySQL Connector/J 8.0.19 (Jan 13, 2020)

  • Bugs Fixed:
  • The RPM package for Connection/J provided by the MySQL Yum repository did not have its epoch set; as a result, the package could not be installed on an Enterprise Linux or Fedora system even if the MySQL Yum repository has been enabled, because the Connector/J package in the native repository had the epoch set to 1. This fix sets the epoch also to 1 for the RPM package provided by the MySQL Yum repository, in order to prevent the installation problem. (Bug #30566384, Bug #97700)
  • For some prepared statements, calling getMetaData() on them resulted in an Incorrect DATE error, even when no DATE values were involved. This was due to some recent changes on the MySQL 8.0 Server, to which this patch adjusts Connector/J. (Bug #30151808, Bug #96442)
  • References: See also: Bug #29025656, Bug #28940878.
  • When retrieving TIME values using ResultSet.getTimestamp(), the fractional seconds are truncated when useCursorFetch=true. This patch corrects the problem by fixing the TIME value decoding in the MysqlBinaryValueDecoder. It also corrects some inconsistencies in formatting the fractional seconds when returning the TIME values as strings. (Bug #30119545, Bug #96383)
  • Streaming of multiple result sets failed with an error. It was due to an error in switching the streamer source from one result set to another, and this fix corrects the issue. (Bug #29999318, Bug #96059)

New in MySQL Connector/J 8.0.18 (Oct 14, 2019)

  • Bugs Fixed:
  • A minor code improvement has been put into DatabaseMetaDataUsingInfoSchema.getColumns(). (Bug #29898567, Bug #95741)
  • For a replication setup, when the connection property loadBalanceAutoCommitStatementThreshold was set to any values other than 0, load-balancing server switching failed. It was because in this case, LoadBalancedAutoCommitInterceptor did not have the required access to the parent connection proxy that had established the connection, and this fix enables such access. (Bug #25223123, Bug #84098)
  • An attempt to retrieve multiple result sets returned by asynchronous executions of stored procedures resulted in an ExecutionException. With this fix, Connector/J now works properly when asynchronous executions return multiple result sets. (Bug #23721537)

New in MySQL Connector/J 8.0.17 (Oct 14, 2019)

  • Functionality Added or Changed:
  • X DevAPI: The following methods have been deprecated:
  • Collection.find().where()
  • Collection.modify().where()
  • Collection.remove().where()
  • X DevAPI: Two new operators for JSON objects and arrays, OVERLAPS and NOT OVERLAPS, are now supported.
  • X DevAPI: Indexing for array fields is now supported. See Indexing Array Fields in the X DevAPI User Guide for details.
  • The README and LICENSE files are now included inside the Connector/J JAR archive delivered in the platform-independent tarballs and zip files. (Bug #29591275)
  • A number of private parameters of ProfilerEvents (for example, hostname) had no getters for accessing them from outside of the class instance. Getter methods have now been added for all the parameters of the class. (Bug #20010454, Bug #74690)
  • A new connection property, databaseTerm, sets which of the two terms is used in an application to refer to a database. The property takes one of the two values CATALOG or SCHEMA and uses it to determine which Connection methods can be used to set/get the current database, which arguments can be used within the various DatabaseMetaData methods to filter results, and which fields in the ResultSet returned by DatabaseMetaData methods contain the database identification information. See the entry for databaseTerm in Configuration Properties for details.
  • Also, the connection property nullCatalogMeansCurrent has been renamed to nullDatabaseMeansCurrent. The old name remains an alias for the connection property.
  • Thanks to Harald Aamot for contributing to the patch. (Bug #11891000, Bug #27356869, Bug #89133)
  • A new CONTRIBUTING file has been added to the Connector/J repository on GitHub, which provides guidelines for code contribution and bug reporting.
  • The MySQL Connector/J X DevAPI Reference can now be generated from the Connector/J source code as an Ant target, xdevapi-docs.
  • Added support for host names that are longer than 60 characters (up to 255 characters), as they are now supported by MySQL Server 8.0.17.
  • Added support for the utf8mb4_0900_bin collation, which is now supported by MySQL Server 8.0.17.
  • A cached server-side prepared statement can no longer be effectively closed by calling Statement.close() twice. To close and de-cache the statement, do one of the following:
  • Close the connection (assuming the connection is tracking all open resources).
  • Use the implementation-specific method JdbcPreparedStatement.realClose().
  • Set the statement as non-poolable by calling the method Statement.setPoolable(false) before or after closing it.
  • Bugs Fixed:
  • X DevAPI: The IN operator in X DevAPI expressions, when followed by a square bracket ([), got mapped onto the wrong operation in X Protocol. (Bug #29821029)
  • When using a replication connection, retrieving data from BlobFromLocator resulted in a ClassCastException. It was due to some wrong and unnecessary casting, which has been removed by this fix. (Bug #29807741, Bug #95210)
  • ResultSetMetaData.getTableName() returned null when no applicable results could be returned for a column. However, the JDBC documentation specified an empty string to be returned in that case. This fix makes the method behave as documented. The same correction has been made for getCatalogName() and getSchemaName(). (Bug #29452669, Bug #94585)
  • ResultSetImpl.getObject(), when autoboxing a value of a primitive type retrieved from a column, returned a non-null object when the retrieved value was null. (Bug #29446100, Bug #94533)
  • ResultSetImpl.getDouble() was very inefficient because it called FloatingPointBoundsEnforcer.createFromBigDecimal, which needlessly recreated BigDecimal objects for the fixed minimum and maximum bounds. With this fix, the objects BigDecimal.valueOf(min) and BigDecimal.valueOf(max) are cached after they are first created, thus avoiding their recreations. (Bug #29446059, Bug #94442)
  • Enabling logSlowQueries resulted in many unnecessary calls of LogUtils.findCallingClassAndMethod(). With this fix, LogUtils.findCallingClassAndMethod() is called only when profileSQL is true and even in that case, the number of calls are reduced to a minimal to avoid the excessive stack trace data the function used to generate. Thanks to Florian Agsteiner for contributing to the fix. (Bug #29277648, Bug #94101, Bug #17640628, Bug #70677)
  • Characters returned in a ResultSet were garbled when a server-side PreparedStatement was used, and the query involved concatenation of a number and a string with multi-byte characters. That was due to an issue with the number-to-string conversion involved, which has been corrected by this fix. (Bug #27453692)
  • Calling ProfilerEvent.pack() resulted in an ArrayIndexOutOfBoundsException. It was due to a mishandling of data types, which has been corrected by this fix. (Bug #11750577, Bug #41172)

New in MySQL Connector/J 8.0.16 (Oct 14, 2019)

  • Functionality Added or Changed:
  • X DevAPI: Added BigInteger, BigDecimal, and Character as supported classes whose instances can be passed as parameters to a X DevAPI Table statement. Also made the error message clearer when applications try to pass instances of unsupported classes. (Bug #25650912)
  • X DevAPI: Connector/J now supports the ability to send connection attributes (key-value pairs that application programs can pass to the server at connect time) for X Protocol connections. Connector/J defines a default set of attributes, which can be disabled or enabled. In addition, applications can specify attributes to be passed in addition to the default attributes. The default behavior is to send the default attribute set. See the description for the new configuration property xdevapi.connect-attributes for details.
  • X DevAPI: When using X DevAPI, performance for statements that are executed repeatedly (two or more times) is improved by using server-side prepared statements for the second and subsequent executions. See Working with Prepared Statements in the X DevAPI User Guide for details.
  • The version number has been removed from the name of the Connector/J JAR archive within the RPM packages for Connector/J. That makes upgrading Connector/J with RPM packages easier. (Bug #29384853)
  • The collation utf8mb4_zh_0900_as_cs has been added to the CharsetMapping class. (Bug #29244101)
  • The following third-party libraries have been removed from the distribution bundles for Connector/J:
  • Google protobuf for Java (required for using X DevAPI and for building Connector/J from source)
  • C3P0 (required for building Connector/J from source)
  • JBoss common JDBC wrapper (required for building Connector/J from source)
  • Simple Logging Facade API (required for using the logging capabilities provided by the default implementation of org.slf4j.Logger.Slf4JLogger by Connector/J, and for building Connector/J from source)
  • Bugs Fixed:
  • X DevAPI: The method unquoteWorkaround() has been removed from the ExprParser class, as the workaround is no longer needed, and it actually produced wrong results in some cases. (Bug #29257922)
  • X DevAPI: Connector/J threw an error when a JSON document contained only a field with an empty array as its value. With this fix, Connector/J now takes that as a valid JSON document. (Bug #28834959, Bug #92819)
  • X DevAPI: getByte() calls failed on table columns of the BINARY data type. This was due to issues with string conversion, which has been corrected with this fix. (Bug #25650385)
  • X DevAPI: Any statements sent after a failed procedure call caused Connector/J to hang. This was because after the failed call, Connector/J was not aware that the result streamer had already been closed by the server. With this fix, an error is thrown when the procedure call fails, and the result streamer is nullified. (Bug #22038729)
  • X DevAPI: Unary negative and positive operators inside expressions were parsed wrongly as binary minus and plus operators. (Bug #21921956)
  • Because the SHOW PROCESSLIST statement might cause the server to fail sometimes, Connector/J now avoids using the statement, but queries the performance scheme instead for the information it needs. (Bug #29329326)
  • Some unnecessary information has been removed from the Connector/J log. (Bug #29318273)
  • In the DatabaseMetaDataUsingInfoSchema interface, the getProcedureColumns() and getFunctionColumns() methods returned wrong results for the PRECISION column, and the getColumns() and getVersionColumns() methods returned wrong results for the COLUMN_SIZE column. The errors were due to the wrong handling of the temporal type precision by Connector/J, which has now been fixed. (Bug #29186870)
  • For an SSL connection, after a client disconnected from a server by calling Connection.close(), the TCP connection remained in the TIME_WAIT state on the server side. With this fix, the connection remains in the TIME_WAIT state on the client side instead, in most cases. (Bug #29054329, Bug #93590)
  • The function LoadBalancedConnectionProxy.getGlobalBlacklist() always returned an empty map, thus there was never a blacklist for load-balanced connections. (Bug #28860051, Bug #93007)
  • The redundant file, changelog.gz, has been removed from the Debian 9 package for Connector/J. The file repeated the contents of the CHANGES.gz file. (Bug #27786499)
  • Using getBytes() to retrieve TEXT data resulted in a NumberFormatException. With this fix, the proper exception (SQLDataException), is now thrown. (Bug #27784363)
  • A changeUser() call failed with a java.io.IOException when the configuration property enablePacketDebug was set to true for a connection. (Bug #25642021)
  • bindings.getBoolean() always returned false. It was due to a mishandling of data types, which has been corrected with this fix. (Bug #22931700)

New in MySQL Connector/J 8.0.15 (Feb 1, 2019)

  • Version 8.0.15 is the latest General Availability release of the 8.0 series of MySQL Connector/J. It is suitable for use with MySQL Server versions 8.0, 5.7, and 5.6. It supports the Java Database Connectivity (JDBC) 4.2 API, and implements the X DevAPI.
  • Functionality Added or Changed:
  • Default value of the connection property allowLoadLocalInfile has been changed to false. Applications that use the LOAD DATA LOCAL INFILE statement on MySQL Server needs to set this property to true explicitly. (Bug #29261254)

New in MySQL Connector/J 8.0.14 (Jan 21, 2019)

  • Functionality Added or Changed:
  • Important Change: For MySQL Server 8.0.14 and later, 5.7.25 and later, 5.6.43 and later, and 5.5.63 and later, minimal permissions on named pipes are granted to clients that use them to connect to the server. Connector/J, however, can only use named pipes when granted full access on them. As a workaround, the MySQL Server that Connector/J wants to connect to must be started with the system variable named_pipe_full_access_group; see the description for the system variable for more details. (Bug #28971500)
  • X DevAPI: getDefaultSchema() now returns null when no default schema has been set for the Session.
  • Connector/J now has a new property for building from source, com.mysql.cj.build.verbose, which controls the verbosity of the build process' output. Its default value is false, which makes the output considerably shorter comparing with earlier versions of Connector/J. (Bug #28970166)
  • The method ResultSet.getBoolean() now returns FALSE when the designated column is of data type CHAR or VARCHAR and contains an “N” or “n”. This makes Connector/J 8.0 behaves like Connector/J 5.1 when it comes to converting strings to booleans. (Bug #28706219, Bug #92574)
  • Connector/J is now capable of reading and, if needed, ignoring any initial notice packets sent by X Plugin before an X Protocol connection is established.
  • Bugs Fixed:
  • X DevAPI: Connector/J returned a NullPointerException when an application tried to establish an XProtocol connection using a Windows named pipe, which is not supported. With this fix, an XProtoclException is returned instead.
  • This fix also makes sure that instead of a NullPointerException, a proper exception is thrown when an application tries to establish a Classic MySQL Protocol connection with a named pipe, but the named pipe is not specified at connection or it cannot be found on the specified path. (Bug #28606708)
  • X DevAPI: Adding an empty document with executeAsync() resulted in an ERROR 5013 (Missing row data for Insert). With this fix, no error or warning is returned in the case. (Bug #23045642)
  • Collection.count() returned a wrong error message when the collection did not exist. (Bug #28924137)
  • The source code of Connector/J contains non-ASCII characters, which might cause encoding issues during compilation if the system did not also use a UTF-8 locale. With this fix, the build script now handles non-ASCII characters well regardless of the system locale. (Bug #28894344)
  • A memory leak occurred if Connector/J was loaded via the bootstrap class path instead of the main application classpath. It was because AbandonedConnectionCleanupThread failed to initialize its internal thread in that case, so that references for closed connections were not cleaned up, and their number kept growing. This fix repairs the clean up process for closed connections and also makes the process thread safe. (Bug #28747636, Bug #92508)
  • clearInputStream() returned a NullPointerException when the mysqlSocket, mysqlInput, or mysqlOutput object it tried to retrieve was null. With this fix, an IOExcpetion is thrown instead in the situation. Thanks to Henning Schmiedehausen for contributing to the fix. (Bug #28731795, Bug #92625)
  • Updating a result set returned by a server-side prepared statement with SELECT ... FOR UPDATE resulted in an SQLException. (Bug #28692243, Bug #92536)
  • When the connection property zeroDateTimeBehavior was set to CONVERT_TO_NULL, Connector/J converted a TIME type value of 00:00:00 to null. With this fix, it returns a java.sql.Time instance of zero hours, minutes, and seconds, as expected. (Bug #28101003, Bug #91065)
  • When using server-side prepared statements and working with a table with multicolumn primary key, an updateRow() call failed with a NullPointerException or a SQLException. (Bug #25650514)
  • When using server-side prepared statements, a refreshRow() call after an updateRow() call failed with a SQLException. (Bug #25650482)
  • changeUser() failed to change or reauthenticate a user when all of the following were true: (a) connection to the server was by SSL; (b) the caching_sha2 or sha256_password authentication plugin was used for the user; and (c) the user password contained Unicode characters. (Bug #25642226)

New in MySQL Connector/J 8.0.12 (Jul 27, 2018)

  • Fix for Bug#28208000, MASTER : HANG IN ASYNCHRONOUS SELECT TEST.
  • WL#10544, Update MySQL 8.0 keywords list.
  • WL#11858, DevAPI: Core API v1 alignment.
  • Fix for Bug#27652379, NPE FROM GETSESSION(PROPERTIES) WHEN HOST PARAMETER IS GIVEN IN SMALL LETTER.
  • Fix for BUG#87600 (26724154), CONNECTOR THROWS 'MALFORMED DATABASE URL' ON NON MYSQL CONNECTION-URLS.
  • Fix for BUG#26089880, GETCONNECTION("MYSQLX://..") RETURNS NON-X PROTOCOL CONNECTION.
  • WL#11876, Improve connection properties design.
  • WL#11933, Connector/J 8.0 X DevAPI reference documentation update.
  • WL#11860, Ensure >= 75% code coverage.
  • Fix for Bug#90753 (27977617), WAIT_TIMEOUT EXCEEDED MESSAGE NOT TRIGGERED.
  • Fix for Bug#85941 (25924324), WASNULL NOT SET AFTER GETBYTES IS CALLED.
  • Fix for Bug#28066709, COLLECTION.CREATEINDEX() TEST IS BROKEN AFTER WL#11808 IMPLEMENTATION.
  • ix for Bug#90872 (28027459), FILTERPARAMS CLASS IS NOT NEEDED.
  • Fix for Bug#27522054, POSSIBLE ASYNC XPROTOCOL MESSAGE HANDLING PERF ISSUE.
  • The "xdevapi.useAsyncProtocol" connection property default value is changed to "false".

New in MySQL Connector/J 8.0.11 (Apr 19, 2018)

  • WL#11293, DevAPI: Support new locking modes : NOWAIT and SKIP LOCKED.
  • Fix for Bug#90029 (27678308), FAILURE WHEN GETTING GEOMCOLLECTION COLUMN TYPE.
  • Fix for BUG#90024 (27677574), SOME TESTS FAILED AGAINST MYSQL 8.0.5 BECAUSE OF DEPRECATED FEATURES REMOVAL.
  • Fix for Bug#86741 (26314325), Multi-Host connection with autocommit=0 getAutoCommit maybe wrong.
  • Fix for Bug#27231383, PROVIDE MAVEN-FRIENDLY COMMERCIAL PACKAGES WITHOUT "-BIN".
  • Fix for Bug#26819691, SETTING PACKETDEBUGBUFFERSIZE=0 RESULTS IN CONNECTION FAILURE.
  • Fix for Bug#88227 (27029657), Connector/J 5.1.44 cannot be used against MySQL 5.7.20 without warnings.
  • Fix for Bug#27374581, CONNECTION FAILS WHEN GPL SERVER STARTED WITH TLS-VERSION=TLSV1.2.
  • WL#11419, DevAPI: New document _id generation support.
  • WL#11620, Change caching_sha2_password padding.
  • WL#11604, DevAPI: Add SHA256_MEMORY support.
  • Fix for BUG#86278 (26092824), SUPPORT CUSTOM CONSTRUCTION OF SSLSOCKET DURING CONNECTION ESTABLISHMENT.
  • Fix for BUG#27226293, JSONNUMBER.GETINTEGER() & NUMBERFORMATEXCEPTION.
  • WL#10527, Clean up Protocol and Session interfaces.

New in MySQL Connector/J 5.1.46 (Mar 13, 2018)

  • Functionality Added or Changed:
  • Because Connector/J restricted TLS versions to v1.1 and below by default when connecting to MySQL Community Server 8.0 (which used to be compiled with yaSSL by default and thus supporting only TLS v1.1 and below), it failed to connect to to a MySQL 8.0.4 Community Server (which has been compiled with OpenSSL by default and thus supports TLS v1.2) that was configured to only allow TLS v1.2 connections. TLS v1.2 is now enabled for connections with MySQL Community Server 8.0.4 and later. (Bug #27374581)
  • The bundle for Connector/J 5.1 delivered by Oracle now contains an additional jar package with the name mysql-connector-java-5.1.ver.jar (mysql-connector-java-commercial-5.1.ver.jar for commercial bundles). It is identical with the other jar package with the original package named mysql-connector-java-5.1.ver-bin.jar (mysql-connector-java-commercial-5.1.ver-bin.jar for commercial bundles), except for its more Maven-friendly file name. (Bug #27231383)
  • The owner bound for the connection property packetDebugBufferSize has been changed to 1, to avoid the connection errors that occur when the value is set to 0. (Bug #26819691)
  • For multi-host connections, when a MySQL Server was configured with autocommit=0, Connection.getAutoCommit() did not return the correct value. This was because useLocalSessionState=true was assumed for multi-host connections, which might not be the case, resulting thus in inconsistent session states.
  • With this fix, by default, Connector/J executes some extra queries in the connection synchronization process to guarantee consistent session states between the client and the server at any connection switch. This would mean, however, that when none of the hosts are available during an attempted server switch, an exception for closed connection will be thrown immediately while, in earlier Connector/J versions, there would be a connection error thrown first before a closed connection error. Error handling in some applications might need to be adjusted accordingly.
  • Applications can skip the new session state synchronization mechanism by having useLocalSessionState=true. (Bug #26314325, Bug #86741)
  • Connector/J now supports the new caching_sha2_password authentication plugin for MySQL 8.0, which is the default authentication plugin for MySQL 8.0.4 and later (see Caching SHA-2 Pluggable Authentication for details).
  • Because earlier versions of Connector/J 5.1 do not support the caching_sha2_password authentication plugin and therefore will not be able to connect to accounts that authenticate with the new plugin (which might include the root account created by default during a new installation of a MySQL 8.0 Server), it is highly recommended that you upgrade now to Connector/J 5.1.46, to help ensure that your applications continue to work smoothly with the latest MySQL 8.0 Server.
  • Bugs Fixed:
  • When Connector/J 5.1.44 or earlier connected to MySQL 5.7.20 or later, warnings are issued because Connector/J used the deprecated system variables tx_isolation and tx_read_only. These SQL-level warnings, returned from a SHOW WARNINGS statement, might cause some applications to throw errors and stop working. With this fix, the deprecated variables are no longer used for MySQL 5.7.20 and later; also, to avoid similar issues, a SHOW WARNINGS statement is no longer issued for the use of deprecated variables. (Bug #27029657, Bug #88227)
  • When the default database was not specified for a connection, the connection attributes did not get stored in the session_connect_attrs table in the Performance Schema of the MySQL Server. (Bug #22362474, Bug #79612)

New in MySQL Connector/J 5.1.44 (Aug 31, 2017)

  • Functionality Added or Changed:
  • A new connection property, enabledTLSProtocols, can now be used to override the default restrictions on the TLS versions to be used for connections, which are determined by the version of the MySQL Server that is being connected to. By providing a comma-separated list of values to this option (for example, “TLSv1,TLSv1.1,TLSv1.2”) users can, for example, prevent connections from using older TLS version, or allow connections to use TLS versions only supported by a user-compiled MySQL Server. See the entry for the new property in Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J for details. Thanks to Todd Farmer for contributing the code. (Bug #26646676)
  • Bugs Fixed:
  • Important Change: Following the changes in MySQL Server 8.0.3, the system variables tx_isolation and tx_read_only have been replaced with transaction_isolation and transaction_read_only in the code of Connector/J. Users should update Connector/J to this latest release in order to connect to MySQL 8.0.3. They should also make the same adjustments to their own applications if they use the old variables in their codes. (Bug #26440544)
  • When using cached server-side prepared statements, a memory leak occurred as references to opened statements were being kept while the statements were being decached; it happened when either the close() method has been called twice on a statement, or when there were conflicting cache entries for a statement and the older entry had not been closed and removed from the opened statement list. This fix makes sure the statements are properly closed in both cases. Thanks to Eduard Gurskiy for contributing to the fix. (Bug #26633984, Bug #87429)
  • The regression test for Bug#63800 failed because the default value of the system variable explicit_defaults_for_timestamp of MySQL Server has been changed since release 8.0.2. The test has been adjusted to take the change into consideration. (Bug #26501245)

New in MySQL Connector/J 5.1.43 (Jul 31, 2017)

  • Functionality Added or Changed:
  • Update the time zone mappings using the latest IANA and CLDR time zone databases. (Bug #25946965)
  • A new option for the loadBalancingStrategy connection property called serverAffinity has been added. The servers listed in the new connection property serverAffinityOrder (which should be a subset of the servers in the host list of the connection URL) are contacted in the order they are listed until a server is available or until the list of servers is exhausted, at which point a random load-balancing strategy is used with the hosts not listed by serverAffinityOrder. See descriptions for loadBalancingStrategy and serverAffinityOrder in Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J for details. (Bug #20182108)
  • Bugs Fixed:
  • Secure JDBC connections did not fall back to the default truststore when a custom one was not provided. (Bug #26243128)
  • Connector/J failed a number of regression tests in the testsuite related to geographic information system (GIS) functions because of changes to GIS support by the MySQL server. The fix corrects the tests. (Bug #26239946, Bug #26140577)
  • Attempts to connect to a server started with collation utf8mb4_de_pb_0900_ai_ci resulted in null pointer exceptions. (Bug #26090721)
  • In com/mysql/jdbc/ServerPreparedStatement.java, the arguments resultSetType and resultSetConcurrency for a call of Connection.preparedStatement() were swapped. (Bug #25874048, Bug #85885)
  • A NullPointerException was returned when getDate(), getTime(), or getTimestamp() was called with a null Calendar. This fix makes Connector/J throw an SQLException in the case. (Bug #25650305)
  • Some JDBC proxied objects were missing the proper handling of the equals() methods, thus even comparison of one of these proxied objects to its own self with equals() yielded false. This patch introduces proper handling for the equals() method in all the relevant proxies. (Bug #21931572, Bug #78313)
  • A server-side prepared statement was not closed when the same statement was being prepared again while the original statement was being cached. This was caused by the silent replacement of the cache entry of the old statement by the new. When this happened repeatedly, it caused eventually the complaint that max_prepared_stmt_count was exceeded. This fix makes sure that when a cache entry for a statement replaces an older one, the older statement is immediately closed. (Bug #20066806, Bug #74932)

New in MySQL Connector/J 5.1.42 (Jul 31, 2017)

  • Functionality Added or Changed:
  • A null value can now be extracted from a result set to a class belonging to the java.time package. Before, such an extraction resulted in a NullPointerException being thrown. Thanks to Martin Desharnais for contributing to the fix. (Bug #25250938, Bug #84189)
  • Connector/J now checks that a MySQL server's SSL certificate and the Certificate Authority (CA) that issued it are not expired before establishing an SSL connection with the server, even if the connection property verifyServerCertificate is set to false. (Bug #20515688)
  • Name-value pairs contained in the connection property sessionVariables can now be separated by either commas or a semicolons. (Bug #17757070)
  • Added Japanese collation for the utf8mb4 character set.
  • Bugs Fixed:
  • An invalid timezone identifier was used in StatementRegressionTest.java of the Connector/J testsuite. (Bug #25687718, Bug #85351)
  • A mysql client failed to establish an SSL connection to the server using the SSL certificates provided in the Connector/J source package. It was because the certificates have been generated with the same Common Name. This fix corrects the Common Names and regenerates the SSL certificates. (Bug #25636947)
  • The unit test testsuite.simple.ResultSetTest.testPadding failed with the error Unknown character set: 'gb18030' after the collation map updates in release 5.1.40. (Bug #25556597)
  • In a multi-host connection, query timeouts did not occur as configured. It was because the CancelTask thread, when trying to access the top level, virtual connection object, ran into a race condition with the connection monitor and then hung. With this fix, the CancelTask thread is passed a direct reference to the underlying physical connection, with which it can execute the cancellation. (Bug #25490163, Bug #84783)
  • CallableStatement.extractProcedureName() did not return the correct result when the procedure name contained a dash. This was due to an error in the stripComments() method of the StringUtils class, which has now been corrected. (Bug #25321524, Bug #84324)
  • The ConnectionImpl.isReadOnly() method returned a confusing error message when it could not retrieve the read-only status of the server. The message has now been changed to “Could not retrieve transaction read-only status from server.” (Bug #25101890, Bug #83834)
  • A NullPointerException was thrown when a null boolean value was being read from the database. (Bug #25048406, Bug #83662)
  • After a BIT value had been retrieved from a result set, the wasNull() method of the result set returned value for the last wasNull() query instead of the value for the last retrieved column. (Bug #24841670, Bug #83368)
  • Using a partially-quoted identifier (with only the database or the procedure name quoted) or a non-existent parameter to register an output parameter in a CallableStatement caused a NullPointerException. With this fix, a partially-quoted identifier is accepted, and a non-existent parameter causes a SQLError to be thrown. (Bug #22333996, Bug #79561)
  • DatabaseMetaData.getProcedureColumns() and DatabaseMetaData.getFunctionColumns() did not return expected results. This was due to the errors with the matching algorithm for the column names, which have now been fixed. Notice that, however, the effects of the connection parameter getProceduresReturnsFunctions on the two methods when JDBC 4 is used remain unchanged. (Bug #19531384, Bug #73775)
  • When an UpdatableResultSet was used, trying to close the result set and its prepared statement simultaneously by different threads might result in a deadlock. This fix updates the synchronization mechanism for UpdatableResultSet to avoid the issue. (Bug #17653733, Bug #70704)
  • After a connection had already switched catalog with setCatalog(), cached data from the old catalog was returned for a reused server-side prepared statement. With this fix, the cache of a server-side prepared statement cache now includes the catalog in its key to avoid wrong cache hits when the statement is reused on another catalog. (Bug #16714868, Bug #66430)

New in MySQL Connector/J 5.1.41 (Jul 31, 2017)

  • Bugs Fixed:
  • Connections failed with MySQLSyntaxErrorException: Unknown character set when connectionCollation=ISO-8859-13. This was due to an error with Connector/J's internal charset mapping, which has now been fixed. (Bug #25504578)
  • When loading classes through some external class loaders, com.mysql.jdbc.Util threw an NoClassDefFoundError. This was caused by Class.getPackage() returning null when some external class loaders were used. This fix replaces those calls of Class.getPackage() with calls of the new method Class.getName(), which return package names that are extracted from the fully-qualified class names. (Bug #25048543, Bug #83052)
  • In the manifest for the Connector/J JAR file, the Import-Package directive specified version numbers for the javax.net.ssl package. The specification was unnecessary, and it caused the configuration of an SSL connection to a MySQL server to fail in an OSGi environment. The version requirement has now been removed. (Bug #24942672, Bug #82826)
  • In a Fabric setup, when multiple threads required to have hashes computed, an ArrayIndexOutOfBoundsException might be thrown from inside HashShardMapping. This fix prevents the issue by having HashShardMapping.getShardIndexForKey() synchronized. (Bug #24289730, Bug #82203)
  • When the configuration property cacheResultSetMetadata was set to true, a ping query using a PreparedStatement failed with a NullPointerException. This fix moves the ping query to an earlier stage of the statement execution, which prevents the exception. (Bug #23535001, Bug #81706)
  • The setFabricShardTable() method failed to parse qualified table names (in the format of database_name.table_name), which causes SQLExceptions to be thrown. (Bug #23264511, Bug #81108)
  • A race condition occurred when a call of Connection.setNetworkTimeout() was followed closely by a call of Connection.close(), and a NullPointerException might result if the connection was closed before the executor supplied to setNetworkTimeout() was able to set the timeout, as the executor would run into a null mysqlConnection object. This fix removed the race condition. (Bug #21181249, Bug #75615)
  • With the connection properties cacheServerConfiguration=true and elideSetAutoCommits=true, any new connection to the server obtained after the first connection was established had the variable autoCommit equaled false, even if the value of the variable was true on the server. That was because the value of autoCommit was not properly initialized when a new connection was established, and this fix corrects that.
  • Also, since release 5.1.41, the functionality of the property elideSetAutoCommits has been disabled due to Bug# 66884. Any value given for the property is now ignored by Connector/J. (Bug #17756825, Bug #70785)
  • When using Tomcat and a web application that utilized Connector/J was down, Tomcat was unable to stop the AbandonedConnectionCleanupThread started internally by Connector/J, leading to multiple instances of the thread when the web application was restarted; or, Tomcat was able to stop the thread but unable to restart it on reload of the web application. Different combinations of Tomcat's default settings, usage of Tomcat's ServletContextListener feature, and locations of the Connector/J jar could result in the undesired behaviors, as well as warning messages in the Tomcat error log saying it was unable to stop the thread and a memory leak was likely.
  • The implementation of AbandonedConnectionCleanupThread has now been improved, so that there are now four ways for developers to deal with the situation:
  • When the default Tomcat configuration is used and the Connector/J jar is put into a local library directory, the new built-in application detector in Connector/J now detects the stopping of the web application within 5 seconds and kills AbandonedConnectionCleanupThread. Any unnecessary warnings about the thread being unstoppable are also avoided. If the Connector/J jar is put into a global library directory, the thread is left running until the JVM is unloaded.
  • When Tomcat's context is configured with the attribute clearReferencesStopThreads="true", Tomcat is going to stop all spawned threads when the application stops unless Connector/J is being shared with other web applications, in which case Connector/J is now protected against an inappropriate stop by Tomcat; the warning about the non-stoppable thread is still issued into Tomcat's error log.
  • When a ServletContextListener is implemented within each web application that calls AbandonedConnectionCleanupThread.checkedShutdown() on context destruction, Connector/J now, again, skips this operation if the driver is potentially shared with other applications. No warning about the thread being unstoppable is issued to Tomcat's error log in this case.
  • When AbandonedConnectionCleanupThread.uncheckedShutdown() is called, the AbandonedConnectionCleanupThread is closed even if Connector/J is shared with other applications. However, it may not be possible to restart the thread afterwards

New in MySQL Connector/J 5.1.40 (Jul 31, 2017)

  • 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 (Jul 31, 2017)

  • 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)
  • 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)
  • 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 (Jul 31, 2017)

  • 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)

  • 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. (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. (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.36 (Jul 22, 2015)

  • Functionality Added or Changed:
  • The files in the Maven Central Repository for each Connector/J release have been reorganized and a source artifact (*-sources.jar) has been added, for release 5.1.21 and after. (Bug #20283655, Bug #75335)
  • Bugs Fixed:
  • Results returned by DatabaseMetaData.getCatalogs() were not properly sorted by catalog name. (Bug #21215151)
  • A class cast exception occurred when Connector/J was executing a streaming prepared statement in a Fabric environment. (Bug #21184949, Bug #77217)
  • Connector/J did not use the character set specified with the connection property passwordCharacterEncoding for authentication. With this fix, the property is now honored. If it is not set, Connector/J uses the value of characterEncoding instead; if even that is not set, Conenctor/J defaults to UTF-8 for the password's encoding. (Bug #20825727)
  • A failover did not occur for a MySQL Fabric connection during the failure of a master server. It was because the state change of the Fabric connection group was not handled properly, which hs been corrected by this fix. (Bug #20821888, Bug #75113)
  • When the getDate() and getTime() methods of ResultSet were called to retrieve values with fractional seconds, a “bad format” error occurred. With this fix, the fractional seconds are dropped before the retrieved values are converted into a Date or Time object. (Bug #20804635)
  • A StringIndexOutOfBoundsException occurred when getProcedureColumns() were trying to return ENUM or SET type procedures or functions that involved reserved words. That was caused by a problem in the parser for the functions' or procedures' CREATE statements, which this fix corrects. (Bug #20727196)
  • At every connection, Connector/J executed a SHOW VARIABLES WHERE statement over a multitude of variables, which consumed a lot of time and memory. To improve the efficiency of the code, this fix replaces the statement with the more efficient SELECT @@variable query and also implements some other related changes. (Bug #20408891, Bug #75592)
  • getProcedures(), getFunctions(), getProcedureColumns(), and getFunctionColumns() returned duplicate results when the connection parameter nullCatalogMeansCurrent was set to “false.” (Bug #19803348)
  • An UnsupportedEncodingException during handshake gave rise to a NullPointerException. With this fix, the NullPointerException is no longer thrown, and a proper error message is provided by Connector/J. (Bug #18758686, Bug #72630)
  • When using Connector/J with MySQL Fabric, the createGroup() method failed with a ClassCastException. (Bug #18719760, Bug #72546)
  • Using Connector/J to connect with non-null user name and password to a MySQL Fabric server that had authentication disabled resulted in a NullPointerException. (Bug #18425861, Bug #72077)
  • The change user functionality in Connector/J was dependent on Bug# 70865 of the MySQL server (for releases 5.5 and later, the server unnecessarily sends a plugin_request_packet for every COM_CHANGE_USER packet). That dependence made the com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource interface fail for server versions or forks that did not have the same bug. This fix removes that dependence and makes the interface function properly, whether the server suffers Bug# 70865 or not. (Bug #17810800, Bug #70927)
  • JDBC4MySQLPooledConnection keeps a list of statementEventListener instances named statementEventListeners, which is used as monitor lock whenever the fireStatementEvent() method is called. However, because the pooled connection's close() method set statementEventListener to be null, if a prepared statement was closed after its holding pooled connection had already been closed, the subsequent fireStatementEvent() call would run into a NullPointerException. This fix prevents the problem by having JDBC4MySQLPooledConnection initializing statementEventListeners properly and never setting it to null, thus allowing it to be used all the time as a monitor lock. (Bug #16444069, Bug #62452)

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.
  • See the descriptions for these properties in Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J for more 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.34 (May 21, 2015)

  • Functionality Added or Changed:
  • Connector/J now supports connections to MySQL servers through a SOCKS proxy. Two new configuration properties, socksProxyHost and socksProxyPort, have been introduced to support this new feature; see the entries for them in Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J for details. Note that authentication is not directly supported in the current implementation for SOCKS proxy support. (Bug #13940005, Bug #64862)
  • The process for building Connector/J from source has been revamped to fix incompatibilities with Eclipse 4.4, remove dependency on Ant Contrib, improve on the documentation for the code, and to improve on the structure of the output. See Installing from the Development Source Tree for the updated instructions for building Connector/J 5.1.34.
  • Bugs Fixed:
  • When connecting to MySQL server 5.7.4 or earlier, the connection failed when the password was blank for any users created on the server using the mysql_old_password plugin. This fix refactored the testOldPasswordPlugin of Connector/J so that it works well with the server under the situation. (Bug #19383371)
  • An exception was thrown when users tried to run the testsuite.fabric test cases without specifying the property com.mysql.fabric.testsuite.port. With this fix, the Fabric test cases will not be run unless the test environment has been configured. (Bug #18474141)

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

  • 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)
  • 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)
  • 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 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)
  • 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 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 1, 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 11, 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”. For Connector/J 5.1.25, META-INF/INDEX.LIST has been corrected and now points to “mysql-connector-java-5.1.25.jar”.
  • The work around for “mysql-connector-java-5.1.24.jar” prepared for maven.org is to rename the JAR file to “mysql-connector-java-5.1.24-bin.jar” or to download the MySQL Connector/J 5.1.24 driver from http://dev.mysql.com/downloads/connector/j/. (Bug #68801, Bug #16574419)
  • 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. This fix ensures that all active physical connections to slaves are pinged, and that communication exceptions are thrown if:
  • The master connection ping fails, and the connection is currently set to use the master connection via Connection.setReadOnly(false).
  • The Connection object is set to use the slave via Connection.setReadOnly(true), and the currently-selected slave connection ping fails.
  • (Bug #68733, Bug #16526938)
  • 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.24 (May 11, 2013)

  • Bugs Fixed:
  • The Statement.cancel() was made less susceptible to deadlocking, to allow application servers to immediately cancel operations that fail due to transaction timeouts or network issues. The abortInternal() method that was previously part of the MySQLConnection interface is now available through the Connection interface, so it can be tested for and called if available. (Bug #16224249)
  • When a statement was accessing a table in streaming mode, terminating the statement by issuing KILL QUERY from another session could cause a SQLException “Query execution was interrupted” and a stall when the original session issued a ResultSet.close() or Statement.close() method call. This issue resulted from a race condition and so could happen intermittently. (Bug #16198772, Bug #64204)
  • When the connection options noDatetimeStringSync and useTimezone were specified together, which is not allowed, the error message referred to an incorrect option name noDatetimeSync. (Bug #16061665, Bug #68011)
  • The connection.getQueryTimeoutKillsConnection() method could be called with a null parameter, causing NullPointerException errors and stack traces. The error depended on a race condition and so occurred intermittently. (Bug #13943631, Bug #64805)

New in MySQL Connector/J 5.1.23 (May 11, 2013)

  • Functionality Added or Changed:
  • 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 when SQLException 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, and specify the fully-qualified class name of this implementation for the serverConfigCacheFactory connection option.
  • 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 if useLocalSessionState is not enabled.
  • Static charset/collation maps were updated, particularly for the ucs2_unicode_ci and utf8_unicode_ci collations.
  • 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 with ErrorCode == 1820 (ER_MUST_CHANGE_PASSWORD). If disconnectOnExpiredPasswords=false, the connection enters “sandbox” mode, where all commands except SET PASSWORD = ... and SET PASSWORD FOR CURRENT_USER() = ... cause an error to be thrown.
  • 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 and LOCK keywords.
  • Bugs Fixed:
  • 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 statement LOAD DATA LOCAL INFILE could cause a java.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 and CachedRowSet. The test suite was modified to not perform comparison of PASSWORD() results when the setting old_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 the AbandonedConnectionCleanupThread.shutdown() call in the contextDestroyed 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:
  • user.package.YourThreadsListener
  • (Bug #14570236, Bug #65909)
  • With the connection parameter rewriteBatchedStatements=true, ResultSetRow.getTimeFast could give an incorrect value for TIME columns containing a fractional part. (Bug #14260352)
  • executeQuery() in Statement.java let TRUNCATE TABLE queries be executed, although that method is supposed to block any request that modifies the database. TRUNCATE TABLE and RENAME TABLE are now filtered for executeQuery(). (Bug #11748257, Bug #35653)
  • If a timestamp value was passed through prepared statement parameters, fractional-second precision was stripped off, even if the underlying field (such as VARCHAR(255)) could store the full value. A workaround was to convert the timestamp value to a string when specifying the prepared statement argument, for example prepped_stmt.setString(1,time_stamp.toString(). This was partly fixed in 5.1.19, but that fix did not cover the case with the setting useLegacyDatetimeCode=true. (Bug #11750017, Bug #40279, Bug #60584)

New in MySQL Connector/J 5.1.22 (May 11, 2013)

  • 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:
  • No operations allowed after connection closed.
  • Connection closed after inability to pick valid new connection
  • during fail-over.
  • (Bug #14563127)
  • 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)
  • Connector/J now avoids synchronization issues in terms of locking order and prepared statements.

New in MySQL Connector/J 5.1.21 (May 11, 2013)

  • Functionality Added or Changed:
  • Connector/J applications can now connect to MySQL servers that use the PAM authentication system. See Connecting Using PAM Authentication for details about the Connector/J support, and The PAM Authentication Plugin for information about this authentication feature of the MySQL server. (Bug #13608088)
  • Bugs Fixed:
  • When a new instance of authentication plugin is obtained (either the default one, or one named in Auth Challenge Packet or in Auth Method Switch Request Packet), it must be checked if plugin's confidentiality requirements are satisfied. If the plugin requested in the Auth Method Switch Request Packet required a secure connection, an insecure connection could be established instead. (Bug #13980303)
  • With a connection encoding of gbk and a server encoding of latin1, a call such as PreparedStatement.setString(1, "0f0f0702") could throw an exception java.lang.StringIndexOutOfBoundsException. (Bug #13943893, Bug #64731)
  • When Connector/J was connected to a MySQL 5.5 server, the error message for an invalid query could be returned in the wrong character set and appear garbled. (Bug #13702427, Bug #64205)
  • By default, if an I/O error occurred while executing a query a deadlock could occur as Connector/J attempted to close all open statements (by calling method ConnectionImpl#closeAllOpenStatements) The deadlock would occur if any execute*(*) method of another instance of the StatementImpl class was called by another thread. A workaround was to set the property dontTrackOpenResources to true. (Bug #12590053, Bug #61247)
  • The timezone entry was missing for “MEST - Middle European Summer Time”. (Bug #11748548, Bug #36662)
  • Specifying a non-existent character set in the characterEncoding or characterSetResults connection options could produce a NullPointerException error. The error could occur with a typographical mistake, such as using a hyphen instead of an underscore in the name. (Bug #11749010, Bug #37931)

New in MySQL Connector/J 5.1.20 (May 11, 2013)

  • Bugs Fixed:
  • Important Change: This fix corrects an issue introduced in Connector/J 5.1.19 that caused connection errors with MySQL 4.1 and earlier servers. A java.lang.ClassCastException exception occurred during connection initialization when com.mysql.jdbc.ConnectionImpl.buildCollationMapping() interpreted the output of the SHOW COLLATION statement. (Bug #13958793)
  • Using Connector/J 5.1.19 in combination with JBoss could result in an error while establishing a connection: MySQLNonTransientConnectionException: Bad handshake. This issue occurred when using the old-style password hash, which requires the mysql_old_password plugin during handshake. A workaround was to replace the 16-byte hash with a 41-byte one, as explained in Password Hashing in MySQL. (Bug #13990612, Bug #64983)
  • A MySQLSyntaxErrorException could occur when calling certain methods while connected to a MySQL 5.6.5 or higher server. Affected methods included StatementImpl.execute() and PreparedStatement.execute(). The cause was the removal of the SET OPTION syntax in the MySQL Server. The methods were modified to use the newer SET syntax internally. (Bug #13955027)
  • A java.lang.StringIndexOutOfBoundsException exception could occur when manipulating date/time values with fractional seconds. (Bug #13960556)
  • The savepoint identifier generated by the java.sql.Connection#.setSavepoint() function could be misinterpreted as a floating-point number, for example values such as 123e10 or 123e10foo. Such values could cause replication errors on slave servers because the values are not quoted in the binary log. The fix ensures that the savepoint identifiers do not begin with digits. (Bug #11763271, Bug #55962)
  • If the string limit was used in a column name, prepared statements incorrectly treated the statement as if it used a LIMIT clause. For example, a prepared statement with maxrows set to 0 could incorrectly reuse the value from a previous call to setMaxRows(). This issue applied to both quoted and unquoted column names, and server-side and client-side prepared statements. (Bug #11748492, Bug #36478)

New in MySQL Connector/J 5.1.19 (May 11, 2013)

  • Functionality Added or Changed:
  • Added support for pluggable authentication. via the com.mysql.jdbc.AuthenticationPlugin interface (which extends the standard “extension” interface). Examples are in com/mysql/jdbc/authentication and in testsuite.regression.ConnectionRegressionTest. This feature introduces three new connection properties:
  • authenticationPlugins defines a comma-delimited list of classes that implement com.mysql.jdbc.AuthenticationPlugin and are used for authentication unless disabled by the disabledAuthenticationPlugins property.
  • disabledAuthenticationPlugins defines a comma-delimited list of classes implementing com.mysql.jdbc.AuthenticationPlugin or mechanisms, i.e. mysql_native_password. The authentication plugins or mechanisms cannot be used for authentication. Authentication will fail if it requires one of these classes. It is an error to disable the default authentication plugin, either the one named by defaultAuthenticationPlugin property or the hardcoded one if defaultAuthenticationPlugin property is not set.
  • defaultAuthenticationPlugin defines the name of a class implementing com.mysql.jdbc.AuthenticationPlugin, which is used as the default authentication plugin. It is an error to use a class that is not listed in authenticationPlugins and is not one of the built-in plugins. It is an error to set as default a plugin that is disabled by being listed in the disabledAuthenticationPlugins property. It is an error to set this value to null or the empty string; there must be at least one valid default authentication plugin specified for the connection, meeting all the constraints listed above.
  • Bugs Fixed:
  • Reduced the memory overhead for server-side prepared statements. Each prepared statement allocated a 4K buffer for converting streams. Now this allocation is skipped when no set*Stream() methods have been used.
  • The Connection.changeUser() method did not check for closed connections, leading to NullPointerException errors when this method was called on a closed connection.

New in MySQL Connector/J 5.1.18 (May 11, 2013)

  • Functionality Added or Changed:
  • Added the function MYSQL_INDEX_TO_MYSQL_CHARSET to retrieve the server charset name, using an index instead of parsing variables to CharsetMapping.java
  • Bugs Fixed:
  • The LRUCache implementation removed the eldest entry, rather than the least-recently accessed. (Bug #13036537)
  • Changed cacheCallableStatements to cacheCallableStmts in maxPerformance.properties, to allow proper caching. (Bug #13036309)
  • Added a new ant flag, com.mysql.jdbc.junit.fork, which controls whether JUnit will fork new processes.
  • The value on: The default, and legacy behavior. Or off): Required for Windows, as otherwise process fork failure errors will result while running the test suite via ant on Windows. (Bug #12784170)
  • Not putting a space between VALUES() and ON DUPLICATE KEY UPDATE causes connector/J to both (A) Rewrite the query, although it includes an ON UPDATE statement and (B) To generate the wrong query with multiple ON DUPLICATE KEY statements. (Bug #12565726)
  • The loadBalanceBlacklistTimeout option was not functioning properly. Working connections were not being removed from the blacklist. (Bug #63135)
  • Connector/J now guards against the condition where a call to KILL QUERY will kill the next query issued by the server, if no query is in process. (Bug #61501)
  • The "old" warnings were returned when Statement.getWarnings() was called after Statement.clearWarnings(). (Bug #61866, Bug #12791594)
  • Calling Statement.cancel() on a statement that isn't currently executing, will cause a later-executed query on the same connection to be unexpectedly canceled. The driver now guards against this condition, but it is an underlying server issue. The MySQL statement KILL QUERY (which is what the driver uses to implement Statement.cancel()) is rather non-deterministic, and thus the use of Statement.cancel() should be avoided if possible. (Bug #61501)
  • A connection could not be established when the URL contained both sessionVariables and characterEncoding. (Bug #61201, Bug #12649557)
  • Reverting changes made to ConnectionImpl.java, the private boolean characterSetNamesMatches function.