MariaDB Connector/J 3.0.0 is a Alpha(Alpha) release.
Do not use non-stable (non-GA) releases in production!
NOTE: MariaDB Connector/J 3.0.0 is fully compatible with the latest release of version 2.7. Further maintenance releases will not be provided for version 2.7 after MariaDB Connector/J 3.0 becomes stable (GA).
This version is a complete rewrite of the Java driver. The goal being to have a
more performant, easy to read, extendable, small driver.
Complete rewrite, code simplification / clarification, reduced size (15%),
more than 90% coverage tested.
Performance Improvements:
Prepare and execution are now using pipelining when using option useServerPrepStmts
Performance enhancement with server when using option useServerPrepStmts, skipping metadata (see )
SSL configuration
New Options :
The options useSsl, trustServerCertificate, and disableSslHostnameVerification still exist, but sslMode allows for easier configuration.
Easy logging
If using slf4j, just enable the package "org.mariadb.jdbc" log.
Level ERROR will log connection errors
Level WARNING will log query errors
Level DEBUG will log queries
Level TRACE will log all exchanges with server
If not using slf4j, console logging will be used.
If you really want to use the JDK logger, the System property
"mariadb.logging.fallback" set to JDK will indicate to use common
logging.
Failover
The Failover implementation now permits redoing transactions : when creating a
transaction, all commands will be cached, and can be replayed in case of
failover.
This functionality can be enabled using the option transactionReplay.
This is not enabled by default, because it requires that the application avoid using non-idempotent commands.
Example:
Allow setup of socket TCP_KEEPIDLE, TCP_KEEPCOUNT, TCP_KEEPINTERVAL
Equivalent options are tcpKeepIdle, tcpKeepCount, tcpKeepInterval
Because these are available only with Java 11, setting these options with java < 11 will have no effect.
permit authentication plugin restriction
New Options :
example setting restrictedAuth to "mysql_native_password,client_ed25519,auth_gssapi_client", only those plugins can be use. If server return ask for an authentication plugin not listed in restrictedAuth, driver will throw an exception.
Extendable
The driver is built with a Service Provider Interface (SPI), permitting easy ways to extend the driver.
org.mariadb.jdbc.plugin.authentication.AuthenticationPlugin : Allows authentication plugin additions. Defaults are "mysql_clear_password", "auth_gssapi_client", "client_ed25519", "mysql_native_password", "dialog" (PAM), and "caching_sha2_password"
org.mariadb.jdbc.plugin.credential.CredentialPlugin : Allows login/password retrieval. Defaults are "AwsIamCredentialPlugin" to permit retrieve a temporary IAM authentication, "EnvCredentialPlugin" to get environment authentication, and "PropertiesCredentialPlugin" to get authentication info from java property
For an overview of MariaDB Connector/J see thepage
Notable Changes
When multiple hosts are defined in the connection URL and no failover or load balancing mode is used, MariaDB Connector/J will try the hosts sequentially until a connection is successful.
LOAD DATA LOCAL INFILE is now enabled by default on the client side, for compatibility with MariaDB Connector/J 2.7.
The connector validates that only the filename used in the original request will be provided, to prevent a man-in-the-middle change of the filename.
Bugs Fixed
ArrayIndexOutOfBoundsException when alias length > 250
value after milliseconds precision lost when timestamp is encoded
keep clientCertificateKeyStoreUrl and clientCertificateKeyStoreUrl aliases
Changelog
For a complete list of changes made in MariaDB Connector/J 3.0.5, with links to detailed
information on each push, see the .
Do not use non-stable (non-GA) releases in production!
NOTE: MariaDB Connector/J 3.0.1 is fully compatible with the latest release of version 2.7. Further maintenance releases will not be provided for version 2.7 after MariaDB Connector/J 3.0 becomes stable (GA).
For an overview of MariaDB Connector/J see thepage
Notable Changes
See for 3.0 release.
with the following fixes :
Bugs Fixed
Provide JPMS module descriptor
metadata query performance correction
MariaDbPoolDataSource leaks connections when the mariadb server restarts
Changelog
For a complete list of changes made in MariaDB Connector/J 3.0.1, with links to detailed
information on each push, see the .
This might cause Batch performance regression. In case of non use of LOCAL DATA LOCAL INFILE, disable option allowLocalInfile explicitly can improve performance.
metadata TEXT/TINYTEXT/MEDIUMTEXT/LONGTEXT wrong column type and length
java.time.OffsetDateTime not supported
compatibility with 2.7: now loop through hosts when multiple host without failover mode
java.time.Instant not supported
resultset for negative TIME value return erronous LocalDateTime values
better error message when not loading serverSslCert file
clearParameters() breaks validity when using output parameters in stored procedures
org.mariadb.jdbc.ClientPreparedStatement is missing a toString implementation, useful for logging
The authentication is restricted to the methods 'mysql_native_password,client_ed25519,auth_gssapi_client' instead of allowing all supported methods, if the option restrictedAuth is not set (default NULL).
32 bit value returned instead of a 64 bit value for generated id / updated rows
When the load-balancing HA mode is used a host is not used anymore after a connection failed, even if a connection would be possible again.
Connection.getMetaData() returns values of type MariaDbClob instead of the expected type String
metadata.getColumnTypeName() returns the values with a wrong types
A connection fails if the password is set before the username for MariaDbDataSource
The login packet has non-standard length information for the attributes, which can result in issues when using wireshark.
When using failover the definition of retriesAllDown is ignored when trying to reconnect
Updates of rows is not possible for storage engines which do not provide the metadata information for primary columns
Do not use non-stable (non-GA) releases in production!
NOTE: MariaDB Connector/J 3.0.2 is fully compatible with the latest release of version 2.7. Further maintenance releases will not be provided for version 2.7 after MariaDB Connector/J 3.0 becomes stable (GA).
For an overview of MariaDB Connector/J see thepage
Notable Changes
See and for 3.0 release.
with the following changes:
Feature
Java 9 module full support ( Aws IAM credential now use sdk v2 authentication to permit use of modules)
Ensure having connection's thread id in Exception / debug logs
Bugs Fixed
Ensure pool connections validation when a socket fail
Changelog
For a complete list of changes made in MariaDB Connector/J 3.0.2, with links to detailed
information on each push, see the .
NOTE: MariaDB Connector/J 3.0.3 is NOT fully compatible with the latest release of version 2.7.
For an overview of MariaDB Connector/J see thepage
New version 3.0 is a complete rewrite of the connector, with code simplification, reduced size (15%), more than 90% coverage tested, with performance gain.
Licence is still LGPL-2.1 or later with copyright to MariaDB Corporation AB only (2.x was a fork from Drizzle-JDBC - BSD licensed)
What’s new :
Binary prepare statement improvement
faster connection creation
Support of new 10.6 metadata skip
Pipelining PREPARE
Performance
Other than features, connector permit significant performance improvements :
Here are real world TPCC benchmarks results, comparing connector version 2.7.4 and 3.0.3
Binary prepare statement improvement
When using option useServerPrepStmts, the connector uses BINARY protocol, meaning executing PREPARE + EXECUTE commands.
Pipelining
Queries issued from the application are sent one by one to the server, waiting on the results of the first query before sending the next. Communication with the server follows this synchronous request-response messaging pattern.
When using binary protocol, a PREPARE command is issued (if not in cache) before executing an EXECUTE command.
For MariaDB server 10.2+, the connector will send an optimistic PREPARE + EXECUTE, sending queries one after another. EXECUTE command will be executed only if the PREPARE command succeeds. This avoids some network latency reading PREPARE result before sending EXECUTE command.
Support of new 10.6 metadata skip
10.6 Server with permit to avoid resending metadata when they haven’t changed.
This concerns SQL commands that return a resultset, when using option useServerPrepStmts.
Now, the server will send metadata only if they have changed (DDL change for example). This avoids useless information transiting on the network and parsing those metadata.
Connector internal JMH Benchmark results, selecting one row of a 100 int column table :
Avoiding additional command on connection creation
Connection creation by default won't execute additional command to set session environement.
Depending on options, there might be a few commands, but driver avoid them to the maximum.
REDO failover transaction
After a failover occurs, reconnection will be automatically done according to high-availability configuration. Even if implementation is now smaller and clearer, the result will be the same.
After reconnection, the connector might still throw an exception if the state is unsure. Failover on replica are transparent.
This is different when the failover occurs during the execution of a query on a master server.
A new option transactionReplay permit to replay transactions :
Most of the time, queries occur in transactions so redo transaction implementation will solve most of the failover cases transparently. Option is disabled by default. When enabled, all queries in a transaction are cached until transaction resolution.
If a failover occurs, the driver will recreate a new connection and replay cache.
There is a few limitations:
When the last command was a "commit" sent to the server, an exception will be thrown, the driver cannot know the current state.
application must have idempotent queries only (queries can be "replayable")
If the transaction is too big (cache size limit set with new option transactionReplaySize), the driver won’t cache the transaction anymore, so a failover during that specific transaction will result in throwing an exception.
Better java version support
Driver uses Multi-Release JARs (MRJAR), to simultaneously contain implementations for different versions of java. This permit still supports Java 8, but provides solutions for higher versions of java.
Connector now provides a java 9 full module-info JPMS descriptor
Java 11 socket extended option TCP_KEEPIDLE, TCP_KEEPCOUNT and TCP_KEEPINTERVAL are now configurable with tcpKeepIdle, tcpKeepCount, tcpKeepInterval options respectively. (These options don't have any effect if using a java version lower than 11).
Authentication plugin restriction
A new option restrictedAuth permits to restrict authentication plugins.
Example connection string jdbc:mariadb:*localhost/db?restrictedAuth=mysql_native_password,client_ed25519
will restrict plugin use of standard mysql_native_password and client_ed25519 only.*
Metadata queries performance improvement
Metadata queries use of information_schema improvement for partial or exact matching, permitting faster results.
Easy logging
Logging can now be easily enabled at runtime, using slf4j if present, or fallback to JDK logger / console if not.
INFO level log connection error
DEBUG/FINE level log commands
TRACE/FINEST level log network exchanges
jdbc:mariadb scheme
It occurs that mysql AND mariadb driver are sometimes available in the same classpath,
so, now, driver only accept jdbc:mariadb: by default.
If for some reason, connection string is required to be jdbc:mysql:
Driver will be used only if connection string contain 'permitMysqlScheme'.
example :jdbc:mysql:*localhost/test?permitMysqlScheme.*
Option changed
Ssl configuration use now a new option sslMode to simplify configuration
Possible value are :
disable
trust
verify-ca
verify-full
This can still be done by 2.x options (useSsl, disableSslHostnameVerification, trustServerCertificate) for compatibility, but this is the preferred way.
A new option timezone permits to force session timezone in case of client having a different timezone compare to server. if set timezone must to either offset or IANA tz (like '+5:00' or 'America/New_York')': connector will set connection timezone. This replace options useLegacyDatetimeCode and serverTimezone that did cause some problems when using .
Option removal
Even if connectors aim to be compatible with the 2.x version, there has been very few option removal since connection exists. This is now the time :
allowMasterDownConnection
assureReadOnly
autoReconnect
cachePrepStmts
callableStmtCacheSize
continueBatchOnError
enablePacketDebug
ensureSocketState
failOnReadOnly
failoverLoopRetries
jdbcCompliantTruncation
keyPassword
loadBalanceBlacklistTimeout
Specific support for aurora has been removed, since Issues were piling up without the community proposing any PR for them and without access for us to test those modifications.
Changelog
For a complete list of changes made in MariaDB Connector/J 3.0.3, with links to detailed
information on each push, see the .
connectors now configure replica connection being read-only
autoReconnect
doesn’t have any sense now, better use high availability mode
cachePrepStmts
always cache when using binary protocol
callableStmtCacheSize
always cache when using binary protocol
continueBatchOnError
enablePacketDebug
log are now set using standard logger
ensureSocketState
removed, this was a debugging option
failOnReadOnly
one master must always be present when using master/replica setup
failoverLoopRetries
failover number of attempts rely now only on retriesAllDown option
jdbcCompliantTruncation
The connector ensures STRICT_TRANS_TABLES is always set to follow JDBC expected truncation.
keyPassword
loadBalanceBlacklistTimeout
denied lists are handled automatically, and if all servers are denied, the connector will reconnect using the denied servers. No need for these options anymore.
log
log are now set using standard logger
maximizeMysqlCompatibility
very old option for old mysql connector compatibility
nullCatalogMeansCurrent
was to permit non JDBC behavior for compatibility with old version correction
passwordCharacterEncoding
pinGlobalTxToPhysicalConnection
prepStmtCacheSqlLimit
forced to 8K value
profileSql
log are now set using standard logger
retriesAllDown
not compatible with new failover implementation
rewriteBatchedStatements
replaced by use of faster batching implementation ( COM_STMT_BULK)
serverTimezone
sharedMemory
plugin removed
slowQueryThresholdNanos
staticGlobal
tcpNoDelay
Who would want to disable NAGLE to have a slow connector
tcpRcvBuf
tcpSndBuf
trackSchema
Automatically set
trustStore
Use java standard truststore or option serverSslCert to provide certificates.
trustStorePassword
Same than trustStore
trustStoreType
Same than trustStore
useBatchMultiSend
replaced by use of faster batching implementation ( COM_STMT_BULK)
useBatchMultiSendNumber
See useBatchMultiSend
useFractionalSeconds
server are expected to support fractional seconds (all mariadb server support it, mysql since 5.6)
useLegacyDatetimeCode
useOldAliasMetadataBehavior
was to permit non JDBC behavior for compatibility with old version correction
validConnectionTimeout
No automatic validation done by connector, pool must validate connection, not connector having a thread for that