Reactive Relational Database Connectivity for MySQL. The official successor to mirromutth/r2dbc-mysql(dev.miku:r2dbc-mysql).
See the code
This project contains the MySQL implementation of the R2DBC SPI. This implementation is not intended to be used directly, but rather to be used as the backing implementation for a humane client library to delegate to. See R2DBC Homepage.
See R2DBC MySQL wiki for more information.
r2dbc-mysql supports Spring Boot 4.0 (and Spring Framework 7) starting from version 1.4.2.
Refer to the table below to determine the appropriate version of r2dbc-mysql for your project.
| spring-boot-starter-data-r2dbc | spring-data-r2dbc | r2dbc-spi | r2dbc-mysql(recommended) |
|---|---|---|---|
| 4.0.* and above | 4.0.* and above | 1.0.0.RELEASE | io.asyncer:r2dbc-mysql:1.4.2 |
| 3.0.* and above | 3.0.* and above | 1.0.0.RELEASE | io.asyncer:r2dbc-mysql:1.4.2 |
| 2.7.* | 1.5.* | 0.9.1.RELEASE | io.asyncer:r2dbc-mysql:0.9.7 |
| 2.6.* and below | 1.4.* and below | 0.8.6.RELEASE | dev.miku:r2dbc-mysql:0.8.2 |
This driver provides the following features:
utf8mb4_0900_ai_ci, latin1_general_ci, utf32_unicode_520_ci, etc.caching_sha2_password, mysql_native_password, etc.Connection.validate(ValidationDepth.REMOTE) and the lightweight ping syntax /* ping */ ....Codec(s).RETURNING clause.
In fact, it supports lower versions, in the theory, such as 4.1, 4.0, etc.
However, Docker-certified images do not have these versions lower than 5.5.0, so tests are not integrated on these versions.
<dependency>
<groupId>io.asyncer</groupId>
<artifactId>r2dbc-mysql</artifactId>
<version>1.4.0</version>
</dependency>
dependencies {
implementation 'io.asyncer:r2dbc-mysql:1.4.0'
}
dependencies {
// Maybe should to use `compile` instead of `implementation` on the lower version of Gradle.
implementation("io.asyncer:r2dbc-mysql:1.4.0")
}
Here is a quick teaser of how to use R2DBC MySQL in Java:
// Notice: the query string must be URL encoded
ConnectionFactory connectionFactory = ConnectionFactories.get("r2dbcs:mysql://root:database-password-in-here@127.0.0.1:3306/r2dbc");
// Creating a Mono using Project Reactor
Mono<Connection> connectionMono = Mono.from(connectionFactory.create());
See Getting Started and Configuration Options wiki for more information.
See r2dbc-pool.
connection.createStatement("INSERT INTO `person` (`first_name`, `last_name`) VALUES ('who', 'how')")
.execute(); // return a Publisher include one Result
See Usage wiki for more information.
The R2DBC MySQL Implementation uses GitHub as issue tracking system to record bugs and feature requests. If you want to raise an issue, please follow the recommendations below:
Result should be used (call getRowsUpdated or map/flatMap, even table definition), can NOT just ignore any Result, otherwise inbound stream is unable to align. (like ResultSet.close in jdbc, Result auto-close after used by once)DATETIME or TIMESTAMP, this driver does not attempt time zone conversion. That means should always use LocalDateTime for SQL type DATETIME or TIMESTAMP. Execute SHOW VARIABLES LIKE '%time_zone%' to get more information.trace log level unless debugging. Otherwise, the security information may be exposed through ByteBuf dump.Statement bound returnGeneratedValues, the Result of the Statement can be called both of getRowsUpdated and map/flatMap.
RETURNING clause, zero arguments will make the statement like ... RETURNING *.returnGeneratedValues can only be called with one or zero arguments, and map/flatMap will emit the last inserted id.BIT and JSON
BIT: cannot select 'BIT(64)' with value greater than 'Long.MAX_VALUE' (or equivalent in binary)JSON: different MySQL may have different serialization formats, e.g. MariaDB and MySQL@@global.local_infile by default, make sure @@local_infile is ON before enable allowLoadLocalInfileInPath of the driver. e.g. run SET GLOBAL local_infile=ON, or set it in mysql.cnf.This project is released under version 2.0 of the Apache License.
Thanks a lot for your support!
Java
100.0%
Reactive Relational Database Connectivity for MySQL. The official successor to mirromutth/r2dbc-mysql(dev.miku:r2dbc-mysql).
See the code
This project contains the MySQL implementation of the R2DBC SPI. This implementation is not intended to be used directly, but rather to be used as the backing implementation for a humane client library to delegate to. See R2DBC Homepage.
See R2DBC MySQL wiki for more information.
r2dbc-mysql supports Spring Boot 4.0 (and Spring Framework 7) starting from version 1.4.2.
Refer to the table below to determine the appropriate version of r2dbc-mysql for your project.
| spring-boot-starter-data-r2dbc | spring-data-r2dbc | r2dbc-spi | r2dbc-mysql(recommended) |
|---|---|---|---|
| 4.0.* and above | 4.0.* and above | 1.0.0.RELEASE | io.asyncer:r2dbc-mysql:1.4.2 |
| 3.0.* and above | 3.0.* and above | 1.0.0.RELEASE | io.asyncer:r2dbc-mysql:1.4.2 |
| 2.7.* | 1.5.* | 0.9.1.RELEASE | io.asyncer:r2dbc-mysql:0.9.7 |
| 2.6.* and below | 1.4.* and below | 0.8.6.RELEASE | dev.miku:r2dbc-mysql:0.8.2 |
This driver provides the following features:
utf8mb4_0900_ai_ci, latin1_general_ci, utf32_unicode_520_ci, etc.caching_sha2_password, mysql_native_password, etc.Connection.validate(ValidationDepth.REMOTE) and the lightweight ping syntax /* ping */ ....Codec(s).RETURNING clause.
In fact, it supports lower versions, in the theory, such as 4.1, 4.0, etc.
However, Docker-certified images do not have these versions lower than 5.5.0, so tests are not integrated on these versions.
<dependency>
<groupId>io.asyncer</groupId>
<artifactId>r2dbc-mysql</artifactId>
<version>1.4.0</version>
</dependency>
dependencies {
implementation 'io.asyncer:r2dbc-mysql:1.4.0'
}
dependencies {
// Maybe should to use `compile` instead of `implementation` on the lower version of Gradle.
implementation("io.asyncer:r2dbc-mysql:1.4.0")
}
Here is a quick teaser of how to use R2DBC MySQL in Java:
// Notice: the query string must be URL encoded
ConnectionFactory connectionFactory = ConnectionFactories.get("r2dbcs:mysql://root:database-password-in-here@127.0.0.1:3306/r2dbc");
// Creating a Mono using Project Reactor
Mono<Connection> connectionMono = Mono.from(connectionFactory.create());
See Getting Started and Configuration Options wiki for more information.
See r2dbc-pool.
connection.createStatement("INSERT INTO `person` (`first_name`, `last_name`) VALUES ('who', 'how')")
.execute(); // return a Publisher include one Result
See Usage wiki for more information.
The R2DBC MySQL Implementation uses GitHub as issue tracking system to record bugs and feature requests. If you want to raise an issue, please follow the recommendations below:
Result should be used (call getRowsUpdated or map/flatMap, even table definition), can NOT just ignore any Result, otherwise inbound stream is unable to align. (like ResultSet.close in jdbc, Result auto-close after used by once)DATETIME or TIMESTAMP, this driver does not attempt time zone conversion. That means should always use LocalDateTime for SQL type DATETIME or TIMESTAMP. Execute SHOW VARIABLES LIKE '%time_zone%' to get more information.trace log level unless debugging. Otherwise, the security information may be exposed through ByteBuf dump.Statement bound returnGeneratedValues, the Result of the Statement can be called both of getRowsUpdated and map/flatMap.
RETURNING clause, zero arguments will make the statement like ... RETURNING *.returnGeneratedValues can only be called with one or zero arguments, and map/flatMap will emit the last inserted id.BIT and JSON
BIT: cannot select 'BIT(64)' with value greater than 'Long.MAX_VALUE' (or equivalent in binary)JSON: different MySQL may have different serialization formats, e.g. MariaDB and MySQL@@global.local_infile by default, make sure @@local_infile is ON before enable allowLoadLocalInfileInPath of the driver. e.g. run SET GLOBAL local_infile=ON, or set it in mysql.cnf.This project is released under version 2.0 of the Apache License.
Thanks a lot for your support!
Java
100.0%