Release Notes for MariaDB Connector/J 3.4.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, Java 17, and Java 21.

This release is compatible with JDBC 4.2.

MariaDB Connector/J 3.4.0 was released on 2024-05-17. This release is of General Availability (GA) maturity.

Notable Changes

Zero-Configuration SSL Encryption

(CONJ-1105)

Using SSL (a more correct term would be TLS, but in reality SSL is more commonly used) has been simplified with MariaDB Server 11.4. Before version 11.4, proper SSL configuration required multiple manual steps for the server, and all the clients connecting to it.

For MariaDB Connector/J before 3.4 to establish an SSL encrypted connection, or a MariaDB Server release series previous to 11.4, three options can be used:

  • Have server certificates generated with trusted Certificate Authorities (CA), using a configuration like: sslMode=verify-full

  • Configure the connector using a server certificate, like: sslMode=verify-full&serverSslCert=file:///server-cert.pem

  • Disable the verification of the SSL certificate, which is insecure, and not recommended, using a configuration like: sslMode=trust

For MariaDB Connector/J 3.4 to establish an SSL encrypted connection to MariaDB Server 11.4, enabling SSL does not require any special configuration apart from using sslMode=verify-full. The connector doesn't need to know the server certificate anymore, as long as the password is not empty.

Changes to Timezone Configuration Options for TIMESTAMPS

(CONJ-1171)

MariaDB Connector/J versions before 3.4 provide a single "timezone" option for working with different time zones for clients and servers. While this functionality remains compatible, it's now separated into two distinct settings:

  • connectionTimeZone

  • forceConnectionTimeZoneToSession

There are now 3 options that control timestamps behavior in the java connector:

  • connectionTimeZone: (LOCAL | SERVER | <user-defined time zone>)

    • This option defines the connection's time zone. LOCAL retrieves the JVM's default time zone, SERVER fetches the server's global time zone upon connection creation, and <user-defined time zone> allows specifying a server time zone without requesting it during connection establishment

  • forceConnectionTimeZoneToSession: (true | false)

    • This setting dictates whether the connector enforces the connection time zone for the session

  • preserveInstants: (true | false)

    • This option controls whether the connector converts Timestamp values to the connection's time zone

While remaining compatible with previous versions, this permits more flexibility when handling timezone difference scenarios. See timezone documentation for detailed information.

Add support for connection redirection

(CONJ-981)

Since MariaDB 10.3.1, the server has a new system variable redirect_url to provide a connection string using the format mariadb/mysql://[<user>[:<password>]@]<host>[:<port>]/[<db>[?<opt1>=<value1>[&<opt2>=<value2>]]]

When set, all existing connections will be redirected to the designated URL values when appropriate. A connection will only be redirected when no transaction is active.

Example for enabling the redirection:

set @@global.redirect_url="mariadb://somehost:3306/"

The redirection feature is enabled by default. It can be disabled by setting the new option permitRedirect to FALSE, which will result in ignoring the redirection URL.

Reduced overhead for issuing queries for retrieving and setting isolation level metadata

(CONJ-1154)

When session tracking is supported by the MariaDB Server release series, Connection.getTransactionIsolation() won't query the server as the current state is already known from the session tracking information. Connection.setTransactionIsolation will skip the query to set the transaction isolation level if the server is already using the requested transaction isolation level.

Issues Fixed

  • Connector/J Version 3 Does Not Respect "nullCatalogMeansCurrent" Property (CONJ-1103)

  • Database connection failing on android (CONJ-1161)

  • MariaDB Connector 3 no longer supports query timeout with MySQL (CONJ-1107)

  • Inconsistency in Handling PreparedStatement.executeQuery() between MariaDB and MySQL Connectors (CONJ-1125)

  • getTables should be ordered as expected (CONJ-1156)

  • jdbcCompliantTruncation Does Not Appear To Be Working (CONJ-1163)

  • Variable initialization ahead of LOAD DATA INFILE not possible by validateLocalFileName pattern (CONJ-1164)

  • useBulkStmts compatibility value with pre 3.2 version (CONJ-1168)

  • improve Client prepared statement setMaxRows implementation (CONJ-1169)

  • OFFSET missing from getSQLKeywords (CONJ-1170)

  • DatabaseMetaData#getFunctions's result not property ordered (CONJ-1158)

  • DatabaseMetaData#getClientInfoProperties not ordered correctly (CONJ-1159)

  • Implement connection properties fallbackToSystemKeyStore and fallbackToSystemTrustStore (CONJ-1166)

  • Bulk implementation returning individual results (CONJ-1173)

  • Connector J gives precision of 20 for signed bigint (CONJ-1174)

  • Be able to filter system tables and views (CONJ-1100)