What’s new in MariaDB Connector/J 3.4

We are pleased to announce the general availability (GA) of MariaDB Connector/J 3.4. MariaDB Connector/J 3.4 is the newest version of our interface for building Java applications on top of MariaDB Community Server and MariaDB Enterprise Server.

The MariaDB Connector/J 3.4 release series is replacing the maintenance releases for the 3.3 release series, as the new release series is fully compatible with 3.3.

MariaDB Connector/Node.js 3.4 includes the following enhancements:

  • Zero-Configuration SSL Encryption
  • New Timezone Configuration Options for TIMESTAMPS
  • Support for MariaDB Server connection redirection
  • Reduced overhead for retrieving and setting isolation level metadata

ZERO-CONFIGURATION SSL ENCRYPTION

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), and 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.

NEW TIMEZONE CONFIGURATION OPTIONS FOR TIMESTAMPS

The 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 the TIMESTAMP behavior in the java connector:

  • connectionTimeZone: (LOCAL | SERVER | )
    • 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 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 allows more flexibility when handling scenarios with timezone differences between client and server. See the timezone documentation for detailed information.

SUPPORT FOR MARIADB SERVER CONNECTION REDIRECTION

With MariaDB Community Server 11.3.1 a new global variable redirect_url value has been added, supported 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 RETRIEVING/SETTING ISOLATION LEVEL METADATA

When session tracking is supported by the MariaDB Server release series the application connects to, the function Connection.getTransactionIsolation() does not need to retrieve the currently set isolation level from the server anymore, as the current state is already known from the session tracking information. Function Connection.setTransactionIsolation() will skip the execution of the query to set the transaction isolation level, if the server is already using the requested transaction isolation level.

Resources