MySQL Connector/J 5.1 Release Notes

2.2 Changes in MySQL Connector/J 5.1.48 (2019-07-29, General Availability)

Version 5.1.48 is a maintenance release of the production 5.1 branch. It is suitable for use with MySQL Server versions 5.6, 5.7, and 8.0. It supports the Java Database Connectivity (JDBC) 4.2 API.

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)

  • The collation utf8mb4_zh_0900_as_cs has been added to the CharsetMapping class. (Bug #29244101)

  • The list of MySQL Server reserved words, stored as the MYSQL_KEYWORDS string in the DatabaseMetaData class, has been updated. (Bug #28268619, Bug #91435)

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

  • Added support for the utf8mb4_0900_bin collation, which is now supported by MySQL Server 8.0.17.

Bugs Fixed

  • When a CallableStatement was used to call a stored procedure or function that did not exist on the server or that the client had no rights to access its parameters' metadata, Connector/J tried to infer the parameter metadata from the SQL call string itself, but did so wrongly. It was because Connector/J did not distinguish between a stored procedure and a stored function in its inference, and this fix makes Connector/J do so now. (Bug #29907618)

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

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

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

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

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

  • PreparedStatement.setTimestamp threw a NullPointerException if getParameterMetaData() was called before the statement was executed. This fix adds the missing null checks to getParameterMetaData() to avoid the exception. (Bug #28529781, Bug #92089)

  • Setting the connection property characterEncoding to an encoding that maps to the MySQL character set latin1 or utf8mb4 did not result in the corresponding default connection collation (latin1_swedish_ci or utf8mb4_0900_ai_ci, respectively) to be used on the server. With this fix, the server default is used in the situation. (Bug #28207422)

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

  • ResultSet.updateRow() failed with a MySQLSyntaxErrorException when the server was in NO_BACKSLASH_ESCAPES SQL mode and some but not all text columns were updated. It was because Connector/J sent the strings as hex literals in that case and added to them unnecessary quotes for escapes. This fix add checks to avoid quotes for being added unnecessarily. (Bug #22850444, Bug #80441)

  • PreparedStatement.executeUpdate() failed with a MySQLSyntaxErrorException when the server was in NO_BACKSLASH_ESCAPES SQL mode and BLOB data types were involved in the statement. It was because Connector/J did not escape single quotes in BLOB value properly in NO_BACKSLASH_ESCAPES mode, and the problem has been corrected by this fix. (Bug #20913289)

  • When a procedure and a function with the same name existed in a database, Connector/J retrieved parameter information from both at the same time by default, causing various errors at statement executions. This fix leverages the JDBC 4 DatabaseMetaData methods to return parameter information only from the procedure or function of interest, so that statements are executed without errors. (Bug #19531305, Bug #73774)

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