These release notes were created with the assistance of MySQL HeatWave GenAI.
Version 9.4.0 is a new GA release of MySQL Connector/J. MySQL Connector/J 9.4.0 supersedes 9.3 and is recommended for use on production systems. This release can be used against MySQL Server version 8.0 and later. It supports the Java Database Connectivity (JDBC) 4.2 API, and implements the X DevAPI.
The version requirements for the third-party libraries and tools needed for running and building Connector/J have been updated. See Connector/J Installation and Installing from Source for details. (WL #17009)
You can now retrieve a UUID from a
ResultSet
as ajava.util.UUID
object by callinggetObject(column, UUID.class)
, instead of having to use different getters for different column types. Thanks to Iwao Abe for contributing the code. (Bug #117579, Bug #37639722)The
ResultSet.HOLD_CURSORS_OVER_COMMIT
mode is now consistently supported across connections, statements, and result sets, which was not the case before this fix. However, to preserve backward compatibility with previous behaviors, setting invalid or unknown holdability constants will result in exceptions only if the connection property pedantic is set totrue
. (Bug #44791, Bug #11753361)To simplify the codebase of Connector/J, the
IterateBlock
class has been removed, with its function replaced by traditional for loops. (WL #16917)
When using the
authentication_oci_client
plugin, Connector/J failed to parse the private key file correctly when it contained the optional security markerOCI_API_KEY
at the end. (Bug #38044940)A
java.sql.Time
instance created from a negative millisecond value, when inserted into a database via using aPreparedStatement
, lost its fractional part of the seconds. (Bug #37785888)The method
getObject(String , Class<T>)
returned ajava.lang.AbstractMethodError
for a pooled connection. The error was due to some missing method implementations in the classCallableStatementWrapper
, which are supplied by this patch. (Bug #22473405)DatabaseMetadata.getProcedureColumns()
andDatabaseMetadata.getFunctionColumns()
returned incorrect information when the procedure or function column names include whitespace characters. (Bug #21294134)CallableStatement.registerOutParameter()
failed when the procedure name or parameters contained special characters. (Bug #20279578)A number of connection properties (for example, maxAllowedPacket and resultSetSizeThreshold) accepted negative values while they should not. Connector/J now throws exceptions when users try to set negative values to them. (Bug #19948601)
Enabling
allowMultiQueries
without also enablingrewriteBatchedStatements
caused statements to be rewritten, which was not the expected behavior. With this fix,allowMultiQueries
only allows users to execute multiple queries in a singleStatement
, whereas batching, including statement rewriting, is governed exclusively byrewriteBatchedStatements
. (Bug #118201, Bug #37971552)When using Connector/J 9.3.0 0 with useInformationSchema=true, calling
DatabaseMetaData.getTables
with the argumentscatalog
,schemaPattern
andtableNamePattern
set tonull
caused an SQL syntax exception. (Bug #118100, Bug #37900711)When calling the method
Statement.setMaxRows()
with a negative argument, an exception was thrown with the incorrect message stating that the set value was larger than 50000000. (Bug #118079, Bug #37888527)If the
jdk.charsets
module was not loaded into the JVM, Connector/J mapped UTF-8 connections to the MySQLeucjpms
characterset. This fix corrected the internal character set mapping priority, so thatutf8mb4
is selected in such scenarios. (Bug #116120, Bug #37079448)In the Open Telemetry tracing information, commit operations appeared as
Rollback
spans. This fix corrected them to beCommit
spans. Thanks to Willem Fibbe for contributing the fix. (Bug #115845, Bug #36954268)Inserting unsigned big numbers into a database using a prepared statement failed with a
MysqlDataTruncation
exception when the values are above a certain threshold. Thanks to Yohei Ueki for contributing the patch. (Bug #109339, Bug #34898663)Executing
DatabaseMetadata.getColumns()
with useInformationSchema=true and setting connectionCollation to anything other thanutf8mb3_general_ci
would cause ajava.sql.SQLException
forIllegal mix of collations
. It was because the collations differ between the connection and theinformation_schema
. This patch fixes the metadata query executed ingetColumns()
so that the collations match. (Bug #98620, Bug #31503893)CallableStatement.getObject()
did not return an object in the proper type when a parameter name string was used as its argument. (Bug #77766, Bug #21503942)Canceling a query while streaming results with
java.sql.Statement.cancel()
could leave the connection in an inconsistent state. Subsequent queries also might fail. The behavior was also affected by the connection properties clobberStreamingResults and dontTrackOpenResources, which were not consistently respected. This patch corrects the unexpected behavior, so that a connection can now be reused safely after canceling a streaming query. Nevertheless, it is still strongly recommended to explicitly close any open result sets before executing new queries. (Bug #77658, Bug #21946136)Connection.setNetworkTimeout()
has been reimplemented, so that the executor object passed to it is now ignored (even if it is null) and the timeout value is now configured directly. (Bug #75615, Bug #21181249)The
com.mysql.cj.jdbc.CallableStatement.extractProcedureName()
method might throw an SQLException when encountering whitespace characters in the procedure or function names. (Bug #75441, Bug #20344798)