Reactive programming is already in Java Programming has been around for a long time . High performance , Event driven , Make full use of computing resources , More elegant asynchronous programming experience , At the same time, it also provides a back pressure mechanism to prevent system overload . For a long time Java The response of can only be the same as MongoDB、Redis Wait for these non relational databases to interact . At present, most of our data is stored in relational database , In most cases Java Use JDBC To operate a relational database , and JDBC It's blocked 、 synchronous . So there is an urgent need for a responsive database driven protocol . At present, there are two kinds of responsive database driven protocols on the market , Let's take a look at them .
ADBA yes Oracle Dominant Java Standards for asynchronous database access API . Its purpose is to integrate in the future Java In the standard release of , At present, the development is relatively slow , At present, only OpenJDK Of Sandbox characteristics  For developers to study . It is not intended to do JDBC To extend or replace , It's a completely independent API, The API Provide right JDBC Completely non blocking access to the same database .
Spring The official in the Spring 5 Released responsive Web frame Spring WebFlux After that, the database interaction that can satisfy the asynchronous response is urgently needed API . Due to the lack of standards and drive ,Pivotal（Spring official ） The team started working on reactive relational database connections （Reactive Relational Database Connectivity）, And put forward R2DBC standard API To evaluate the feasibility and discuss whether database vendors are interested in supporting reactive asynchronous non blocking drivers . At the beginning, there was only PostgreSQL 、H2、MSSQL Three , Now? MySQL And joined in .R2DBC The latest version is 0.8.1.RELEASE. In addition to the driver implementation, it also provides **R2DBC** Connection pool  and R2DBC agent . In addition, it also supports cloud native applications .
3.1 Usable R2DBC Drive implementation
Currently available drivers are ：
- cloud-spanner-r2dbc： be used for Google Cloud Spanner Driver program
- jasync-sql：Java and Kotlin Of R2DBC Wrappers , use Kotlin Compiling MySQL and PostgreSQL Asynchronous database driver .
- r2dbc-h2： by H2 Implementation of the native driver , For convenience as a test database .
- r2dbc-postgres： by PostgreSQL Implementation of the native driver .
- r2dbc-mssql： by Microsoft SQL Server Implementation of the native driver .
- r2dbc-mysql： by MySQL Implementation of the native driver .
We need to be clear , No matter what ADBA still R2DBC Not to replace JDBC . Just to fill in the blanks in reactive programming . What about the responsive future , It's not clear yet , But it's growing fast , I'm still optimistic about . For now ADBA Have the advantage of official blessing , and R2DBC Have an active community advantage , Who is the leader of the industry rules , I believe it will be revealed soon . I will try to use it experimentally later R2DBC And share some of these experiences , Pay more attention to