asyncer-io / r2dbc-mysql

Reactive Relational Database Connectivity for MySQL. The official successor to mirromutth/r2dbc-mysql(dev.miku:r2dbc-mysql).
https://r2dbc.io
Apache License 2.0
181 stars 18 forks source link
database event-driven java mysql mysql-client mysql-connector mysql-driver r2dbc r2dbc-mysql reactive reactive-programming reactive-stream reactive-streams

Reactive Relational Database Connectivity MySQL Implementation

Maven Central LICENSE

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.

Spring-framework and R2DBC-SPI Compatibility

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)
3.0.* and above 3.0.* and above 1.0.0.RELEASE io.asyncer:r2dbc-mysql:1.1.0
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

Supported Features

This driver provides the following features:

Version compatibility / Integration tests states

MySQL 5.5 status MySQL 5.6 status MySQL 5.7 status MySQL 8.0 status MySQL 8.1 status MySQL 8.2 status MariaDB 10.6 status MariaDB 10.11 status

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.

Maven


<dependency>
  <groupId>io.asyncer</groupId>
  <artifactId>r2dbc-mysql</artifactId>
  <version>1.1.0</version>
</dependency>

Gradle

Groovy DSL

dependencies {
    implementation 'io.asyncer:r2dbc-mysql:1.1.0'
}

Kotlin DSL

dependencies {
    // Maybe should to use `compile` instead of `implementation` on the lower version of Gradle.
    implementation("io.asyncer:r2dbc-mysql:1.1.0")
}

Getting Started

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.

Pooling

See r2dbc-pool.

Usage

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.

Reporting Issues

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:

Before use

License

This project is released under version 2.0 of the Apache License.

Acknowledgements

Contributors

Thanks a lot for your support!

Supports