Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Reactive Relational Database Connectivity for MySQL. The official successor to mirromutth/r2dbc-mysql(dev.miku:r2dbc-mysql).

License

NotificationsYou must be signed in to change notification settings

asyncer-io/r2dbc-mysql

Maven CentralLICENSE

This project contains theMySQL implementation of theR2DBC SPI.This implementation is not intended to be used directly, but rather to beused as the backing implementation for a humane client library todelegate to. SeeR2DBC Homepage.

SeeR2DBC 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-r2dbcspring-data-r2dbcr2dbc-spir2dbc-mysql(recommended)
3.0.* and above3.0.* and above1.0.0.RELEASEio.asyncer:r2dbc-mysql:1.4.0
2.7.*1.5.*0.9.1.RELEASEio.asyncer:r2dbc-mysql:0.9.7
2.6.* and below1.4.* and below0.8.6.RELEASEdev.miku:r2dbc-mysql:0.8.2

Supported Features

This driver provides the following features:

  • Unix domain socket.
  • Compression protocols, including zstd and zlib.
  • Execution of simple or batch statements without bindings.
  • Execution of prepared statements with bindings.
  • Reactive LOB types (e.g. BLOB, CLOB)
  • All charsets from MySQL, likeutf8mb4_0900_ai_ci,latin1_general_ci,utf32_unicode_520_ci, etc.
  • All authentication types for MySQL, likecaching_sha2_password,mysql_native_password, etc.
  • General exceptions with error code and standard SQL state mappings.
  • Secure connection with verification (SSL/TLS), auto-select TLS version for community and enterprise editions.
  • SSL tunnel for proxy protocol of MySQL.
  • Transactions with savepoint.
  • Native ping can be sent viaConnection.validate(ValidationDepth.REMOTE) and the lightweight ping syntax/* ping */ ....
  • Extensible, e.g. extend built-inCodec(s).
  • MariaDBRETURNING clause.

Version compatibility / Integration tests states

MySQL 5.5 statusMySQL 5.6 statusMySQL 5.7 statusMySQL 8.0 statusMySQL 8.1 statusMySQL 8.2 statusMySQL 8.3 statusMySQL 8.4 statusMySQL 9.0 statusMariaDB 10.6 statusMariaDB 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.4.0</version></dependency>

Gradle

Groovy DSL

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

Kotlin DSL

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

Getting Started

Here is a quick teaser of how to use R2DBC MySQL in Java:

// Notice: the query string must be URL encodedConnectionFactoryconnectionFactory =ConnectionFactories.get("r2dbcs:mysql://root:database-password-in-here@127.0.0.1:3306/r2dbc");// Creating a Mono using Project ReactorMono<Connection>connectionMono =Mono.from(connectionFactory.create());

SeeGetting Started andConfiguration Options wiki for more information.

Pooling

Seer2dbc-pool.

Usage

connection.createStatement("INSERT INTO `person` (`first_name`, `last_name`) VALUES ('who', 'how')")    .execute();// return a Publisher include one Result

SeeUsage 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 log a bug, please search theissue tracker to see if someone has already reported the problem.
  • If the issue doesn't already exist,create a new issue.
  • Please provide as much information as possible with the issue report, we like to know the version of R2DBC MySQL that you are using and JVM version.
  • If you need to paste code, or include a stack trace use Markdown``` escapes before and after your text.
  • If possible try to create a test-case or project that replicates the issue. Attach a link to your code or a compressed file containing your code.

Before use

  • The MySQL data fields encoded by index-based natively, get fields by an index will havebetter performance than get by column name.
  • EachResult should be used (callgetRowsUpdated ormap/flatMap, even table definition), canNOT just ignore anyResult, otherwise inbound stream is unable to align. (likeResultSet.close in jdbc,Result auto-close after used by once)
  • The MySQL server does notactively return time zone when queryDATETIME orTIMESTAMP, this driver does not attempt time zone conversion. That means should always useLocalDateTime for SQL typeDATETIME orTIMESTAMP. ExecuteSHOW VARIABLES LIKE '%time_zone%' to get more information.
  • Should not turn-on thetrace log level unless debugging. Otherwise, the security information may be exposed throughByteBuf dump.
  • IfStatement boundreturnGeneratedValues, theResult of theStatement can be called both ofgetRowsUpdated andmap/flatMap.
    • If server is MariaDB 10.5.1 and above: the statement will attempt to useRETURNING clause, zero arguments will make the statement like... RETURNING *.
    • Otherwise:returnGeneratedValues can only be called with one or zero arguments, andmap/flatMap will emit the last inserted id.
  • The MySQL may be not support well for searching rows by a binary field, likeBIT andJSON
    • 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
  • MySQL 8.0+ disables@@global.local_infile by default, make sure@@local_infile isON before enableallowLoadLocalInfileInPath of the driver. e.g. runSET GLOBAL local_infile=ON, or set it inmysql.cnf.

License

This project is released under version 2.0 of theApache License.

Acknowledgements

Contributors

Thanks a lot for your support!

Supports

  • R2DBC Team - Thanks for their support by sharing all relevant resources around R2DBCprojects.

About

Reactive Relational Database Connectivity for MySQL. The official successor to mirromutth/r2dbc-mysql(dev.miku:r2dbc-mysql).

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors19

Languages


[8]ページ先頭

©2009-2025 Movatter.jp