August 7, 2017

What’s New in MariaDB Connector/J 2.1

We are pleased to announce the general availability (GA) of MariaDB Connector/J 2.1, the newest version of MariaDB Connector/J for Java 8+. 

MariaDB Connector/J 2.1 is fully compatible with MariaDB Connector/J 2.0, so version 2.0.3 was the last maintenance release for 2.0 and will be replaced by version 2.1 moving forward. MariaDB Connector/J 2.1 includes the following new enhancements:

Security

MariaDB Connector/J 2.1 adds verification of SSL certificate name mismatch functionality. When using SSL, the driver will check the hostname against the server's identity as presented in the server's certificate (checking alternative names or certificate CN) to prevent man-in-the-middle attacks.

A new option "disableSslHostnameVerification" can be used to deactivate this new verification, for cases where the old connector behaviour is required.

High Availability

MariaDB Connector/J has provided its own high availability and load balancing functionality for Master-Slave and Multi-Master (Galera) environments since version 1.2.

With the new release and when configured for Multi-Master, the function “Connection.isValid()” is not only validating the connection, it also validates the state of the Galera Cluster node (@@wsrep_cluster_status). If the cluster status of the node is not “Primary”, the connection is not seen as valid and the connection will be removed from the connection pool.

Performance

Batched INSERTS

Batch of INSERTS will now be used for better performance where possible. This enhancement requires MariaDB Server 10.2.7.

A new option "useBulkStmts" can be used to control the use of this protocol enhancement.

Updateable resultset

Updateable resultsets can now be used with “ResultSet.CONCUR_UPDATABLE”.


Example:

Statement stmt = con.createStatement(
                            ResultSet.TYPE_SCROLL_INSENSITIVE,
                            ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stmt.executeQuery("SELECT age FROM TABLE2");
// rs will be scrollable, will not show changes made by others,
// and will be updatable
while(rs.next())
{
     //Retrieve by column name
     int newAge = rs.getInt(1) + 5;
     rs.updateDouble( 1 , newAge );
     rs.updateRow();
}

Download the MariaDB Connector now and learn about the newest evolution of MariaDB Connector/J 2.1.
 

Download Release Notes Knowledge Base

 

About Ralf Gebhardt

Ralf Gebhardt is Product Manager at MariaDB Corporation AB

Read all posts by Ralf Gebhardt