Does MariaDB Connector/J 2.6.x create connections to both master and slave with Aurora?

Cross-posting from Please visit the Stack Overflow question to view the referenced image.

According to other Stack Overflow answers (,, as well as some documentation in the mariadb-connector-j repo (, the consensus seems to be:

On a master/slave cluster, driver will use underlying 2 connections: one to a master instance, one to a slave instance.

A "connection" to aurora mean 2 underlying connection to instances: one to master, one to slave. Driver will use the underlying connection to master or slave according to Connection.setReadonly().

When using the "aurora" keyword, driver , under the hood, create 2 connections: a connection to the primary server, a connection to one of the replicas if any. The goal is always to save resources on the main server. Generally, only one pool is configured. The driver then uses the connection to the primary / replica according to [Connection.setReadOnly]

However, I am trying this for myself and do not see this behavior with MariaDB Connector/J 2.6.2 (in a Play 2.8.x application, which uses HikariCP as the connection pool). I created a new MySQL Aurora cluster (with a master and read-replica) and modified my test application to connect to this cluster with a HikariCP pool that's configured at a fixed size of 8 connections, using the cluster endpoint url as follows:


From what I can see in the logs, as well as the image from the RDS web dashboard's monitoring tab (shown in my Stack Overflow question and at, once the application starts up, the master goes to 8 connections (blue line) and the read-replica has 0 connections (orange line). This seems to be contrary to all the above points that, under the hood, the driver makes 2 underlying connections and chooses between them based on the status of a given Connection's read-only property.

The Play configuration for this connection is as follows:

``` test { driver = org.mariadb.jdbc.Driver url = ""

hikaricp { autoCommit = false readOnly = false } } ```

If I instead configure the connection like:

``` test { driver = org.mariadb.jdbc.Driver url = ""

hikaricp { autoCommit = true readOnly = true } } ``` then I do see connections made to both the master and read-replica (see

Please help me understand this behavior.

What I'm trying to achieve is to have separate write and read pools. The write pool would always point to the master, and the read pool would always point to a read replica (assuming one exists). I want to avoid dual underlying connections, as the `readOnly` setting is configured at the pool level and will never change on a given `Connection` during its lifetime. How can I achieve this?

Additionally, I would like to know whether I am expected to use the autoReconnect parameter when specifying the aurora failover mode. Does the value of that parameter matter with the aurora failover mode?


Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.