# Connector/J 3.1.0 Release Notes

{% hint style="info" %}

<p align="center">The most recent release of <a href="https://app.gitbook.com/s/CjGYMsT2MVP4nd3IyW2L/mariadb-connector-j">MariaDB Connector/J</a> is:</p>

<h4 align="center"><a href="../3.5/3.5.6" class="button secondary">Connector/J 3.5.6</a> <a href="https://mariadb.com/downloads/connectors/connectors-data-access/java8-connector" class="button primary">Download Now</a></h4>
{% endhint %}

[Download](https://mariadb.com/downloads/connectors/connectors-data-access/java8-connector) | **Release Notes** | [Changelog](https://gitbook-v2-q3lwp8faq-gitbook.vercel.app/url/mariadb.com/docs/release-notes/connectors/java/changelogs/3.1/3.1.0) | [About MariaDB Connector/J](https://app.gitbook.com/s/CjGYMsT2MVP4nd3IyW2L/mariadb-connector-j/about-mariadb-connector-j)

**Release date:** 15 Nov 2022

MariaDB Connector/J 3.1.0 is a [***Stable***](https://gitbook-v2-q3lwp8faq-gitbook.vercel.app/url/mariadb.com/docs/release-notes/community-server/about/release-criteria) ***(GA)*** release.

{% hint style="info" %}
**For an overview of MariaDB Connector/J see the** [**About MariaDB Connector/J**](https://app.gitbook.com/s/CjGYMsT2MVP4nd3IyW2L/mariadb-connector-j/about-mariadb-connector-j) **page**
{% endhint %}

## Performance

Other than features, connector permit significant performance improvements, reaching the same level of performance than c connector

Most significant change are :

* [CONJ-1009](https://jira.mariadb.org/browse/CONJ-1009) improve performance reading big result-set
* [CONJ-1014](https://jira.mariadb.org/browse/CONJ-1014) avoid creating array when receiving server packet
* [CONJ-1015](https://jira.mariadb.org/browse/CONJ-1015) pipelining sent (PREPARE+EXECUTE) are now sent into a single buffer, permitting in some case to have only one TCP-IP packet for 2 mysql packet.

Benchmark using JMH one a single 4 core ubuntu 22.04 server (AWS c5.xlarge) shows :

**simple resultset command : "Select 1"**

```java
@Benchmark
  public int run(MyState state) throws Throwable {
    try (Statement st = state.connectionText.createStatement()) {
      ResultSet rs = st.executeQuery("select 1");
      rs.next();
      return rs.getInt(1);
    }
  }
```

![select1](https://1015071241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaEnK0ZXmUbJzqQrTjFyb%2Fuploads%2Fgit-blob-00bef0167203c945deabda511a94c826c96eeb44%2Fselect1.png?alt=media)

**Client side prepared statement parsing : "DO 1000 parameters"**

```java
private static final String sql;

  static {
    StringBuilder sb = new StringBuilder("do ?");
    for (int i = 1; i < 1000; i++) {
      sb.append(",?");
    }
    sql = sb.toString();
  }

  @Benchmark
  public int text(MyState state) throws Throwable {
    try (PreparedStatement st = state.connectionText.prepareStatement(sql)) {
      for (int i = 1; i <= 1000; i++) {
        st.setInt(i, i);
      }
      return st.executeUpdate();
    }
  }
```

![do1000params](https://1015071241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaEnK0ZXmUbJzqQrTjFyb%2Fuploads%2Fgit-blob-9d783f3ebb1be45724d06bd9cc2cb150dfd3448f%2Fdo1000params.png?alt=media)

**resultset with lots of columns : ""select 1 row from a 100 int columns"**

```java
@Benchmark
  public int[] text(MyState state) throws Throwable {
    try (PreparedStatement prep = state.connectionText.prepareStatement("select * FROM test100")) {
      ResultSet rs = prep.executeQuery();
      rs.next();
      int[] objs = new int[100];
      for (int i = 0; i < 100; i++) {
        objs[i] = rs.getInt(i + 1);
      }
      return objs;
    }
  }
```

![select100intcols](https://1015071241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaEnK0ZXmUbJzqQrTjFyb%2Fuploads%2Fgit-blob-3016c5e0333af28133f531e47843f01feebcae85%2Fselect100intcols.png?alt=media)

### UUID Object support

Since MariaDB server 10.7, a new UUID data format is supported.\
getter and setter can now pass java.util.UUID parameter (i.e. PrepareStatement setObject(index, ) / Resultset getObject(index, UUID.class) )

Resultset.getObject without class or type precision will now return UUID object for UUID fields by default

**UUID metadata**

Metadata for UUID fields will now return\
ResultSetMetaData.getColumnTypeName(index) => "uuid"\
ResultSetMetaData.getColumnClassName(index) => "java.util.UUID"\
ResultSetMetaData.getColumnType(index) => Types.OTHER

replacing :

ResultSetMetaData.getColumnTypeName(index) => "CHAR"\
ResultSetMetaData.getColumnClassName(index) => "java.lang.String"\
ResultSetMetaData.getColumnType(index) => Types.CHAR

For compatibility, a new option `uuidAsString` permit to consider UUID as String like previously.

### Other changes

* [CONJ-992](https://jira.mariadb.org/browse/CONJ-992) load balance hosts are now chosen using ROUND ROBIN in place of RANDOM
* [CONJ-1008](https://jira.mariadb.org/browse/CONJ-1008) default value for socket option useReadAheadInput change to false.

## Changelog

For a complete list of changes made in MariaDB Connector/J 3.1.0, with links to detailed\
information on each push, see the [changelog](https://gitbook-v2-q3lwp8faq-gitbook.vercel.app/url/mariadb.com/docs/release-notes/connectors/java/changelogs/3.1/3.1.0).

<sub>*This page is: Copyright © 2025 MariaDB. All rights reserved.*</sub>

{% @marketo/form formid="4316" formId="4316" %}
