Release Notes for MariaDB Connector/J 3.2.0

Overview

MariaDB Connector/J is a lightweight JDBC driver (Type 4) for building applications on top of MariaDB database products with Java 8, Java 11, and Java 17.

This release is compatible with JDBC 4.2.

MariaDB Connector/J 3.2.0 was released on 2023-08-03. This release is of General Availability (GA) maturity.

This document describes the changes in MariaDB Connector/J 3.2.0 when compared to MariaDB Connector/J 3.1.4.

Notable Changes

Selective Bulk Batching for Inserts

  • The new option useBulkStmtsForInserts has been added to support bulk batching only INSERT statements. useBulkStmtsForInserts is enabled by default. (CONJ-920)

    • The option useBulkStmts is disabled by default.

    • The default values for the useBulkStmtsForInserts and useBulkStmts options are optimal for most applications using optimistic locking.

    • For applications that do not use use optimistic locking, enabling useBulkStmts will use the bulk implementation to process UPDATE and DELETE statements faster.

    • For more information, see "Batch Operations with MariaDB Connector/J".

Failover Handling Improvements with MaxScale

With MariaDB MaxScale 23.08.0 and later, to facilitate re-partition after a failover and reduce the time it takes to return to normal operation, when a MaxScale node fails, instead of using "round robin", the connector prioritizes reconnection to MaxScale nodes serving fewer connections. (CONJ-1084)

Improved MySQL Compatibility

The following options have been added to improve compatibility with MySQL:

  • The databaseTerm option accepts one of the two values CATALOG and SCHEMA and determines which connection methods can be used to set or get the current database, which arguments can be used, and which fields contain the database specific information. (CONJ-1088)

  • The useLocalSessionState option avoids unnecessary queries using local state if it is explicitly specified that only JDBC methods should be used. For example, using the connection.setTransactionIsolation() method, and queries like SET SESSION TRANSACTION ISOLATION LEVEL ... are not run directly. (CONJ-1096)

Forced Client-Side Prepared Statements

The /*client prepare*/ prefix allows selectively executing prepared statements on the client side even when the useServerPrepStmts option is enabled. (CONJ-1083)

Collation Mapping

  • The mapping of collations to byte encoding lengths has been updated to include newly added collations. Mapping collations to byte encoding lengths allows calculating the maximum lengths and display sizes for each collation. Mapping collations to byte encoding lengths also allows accurate metadata size for the new Utf8mb4. (CONJ-1094)

Server Collation

  • To ensure that the server's collation is respected, the SET NAMES utf8mb4 statement is executed to use the utf8mb4 charset in all exchanges. (CONJ-1092)

Issues Fixed

  • When using the LOAD DATA INFILE statement on Windows, the statement fails because the path is not correctly concatenated into the regular expression. (CONJ-1075)

  • When performing a batch insert, if the first statement in the batch returns an error, such as a constraint violation, the getGeneratedKeys() method does not return the generated keys for the remaining inserts. (CONJ-1079)

    • Starting with this release, the getGeneratedKeys() method correctly returns keys for batch inserts.

  • When sslMode=verify-ca is set, the trust certificate could not be found because the user-specified value for the trustStoreType parameter is ignored. (CONJ-1080)

    • Starting with this release, the user-specified value for the trustStoreType parameter is handled as expected.

  • The connector does not correctly parse the system variable state change when multiple variable states occur with one query. (CONJ-1082)

  • When a read-only replica is under heavy load and SocketTimeout=0, a connection to the primary replica cannot be established. (CONJ-1091)

    • Starting with this release, connectTimeout is set as the timeout for the socket until a connection is established. This allows setting connectTimeout, while socketTimeout can still be set to 0.