r2dbc.io Open in urlscan Pro
2606:4700:4400::6812:273c  Public Scan

Submitted URL: https://r2dbc.dev/
Effective URL: https://r2dbc.io/
Submission: On October 23 via api from BE — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

R2DBC
Clients Drivers Resources Blog

The Reactive Relational Database Connectivity (R2DBC) project brings reactive
programming APIs to relational databases.


IN A NUTSHELL

Based on the Reactive Streams specification. R2DBC is founded on the Reactive
Streams specification, which provides a fully-reactive non-blocking API.

Works with relational databases. In contrast to the blocking nature of JDBC,
R2DBC allows you to work with SQL databases using a reactive API.

Supports scalable solutions. With Reactive Streams, R2DBC enables you to move
from the classic “one thread per connection” model to a more powerful and
scalable approach.

Provides an open specification. R2DBC is an open specification and establishes a
Service Provider Interface (SPI) for driver vendors to implement and clients to
consume.

Example Query

 * Project Reactor
 * RxJava
 * Smallrye Mutiny



ConnectionFactory connectionFactory = ConnectionFactories
  .get("r2dbc:h2:mem:///testdb");

Mono.from(connectionFactory.create())
  .flatMapMany(connection -> connection
    .createStatement("SELECT firstname FROM PERSON WHERE age > $1")
    .bind("$1", 42)
    .execute())
  .flatMap(result -> result
    .map((row, rowMetadata) -> row.get("firstname", String.class)))
  .doOnNext(System.out::println)
  .subscribe();


ConnectionFactory connectionFactory = ConnectionFactories
  .get("r2dbc:h2:mem:///testdb");

Single.fromPublisher(connectionFactory.create()).toFlowable()
  .flatMap(connection -> connection
    .createStatement("SELECT firstname FROM PERSON WHERE age > $1")
    .bind("$1", 42)
    .execute())
  .flatMap(result -> result
    .map((row, rowMetadata) -> row.get("firstname", String.class)))
  .doOnNext(System.out::println)
  .subscribe();


ConnectionFactory connectionFactory = ConnectionFactories
  .get("r2dbc:h2:mem:///testdb");

Uni.createFrom().publisher(connectionFactory.create())
  .onItem().transformToMulti(connection -> connection
    .createStatement("SELECT firstname FROM PERSON WHERE age > $1")
    .bind("$1", 42)
    .execute())
  .onItem().transform(result -> result
    .map((row, rowMetadata) -> row.get("firstname", String.class)))
  .subscribe().with(System.out::println);



FEATURES

 * Broad type conversion
 * Transactions, isolation levels, and save points
 * Batching
 * BLOB/CLOB support
 * Connection URLs (r2dbc:<driver>://<host>:<port>/<database>)
 * ConnectionFactory discovery and configuration based on Java’s ServiceLoader
 * Typed Exceptions
 * Extensible Interface
 * Observability
 * TCK


RELATIONAL MEETS REACTIVE

Existing standards, based on blocking I/O, cut off reactive programming from
relational database users. R2DBC specifies a new API to allow reactive code that
works efficiently with relational databases.

R2DBC is a specification designed from the ground up for reactive programming
with SQL databases. It defines a non-blocking SPI for database driver
implementors and client library authors. R2DBC drivers fully implement the
database wire protocol on top of a non-blocking I/O layer.


DESIGN PRINCIPLES

R2DBC aims for a minimal SPI surface, specifying only parts that differ across
databases, and is fully reactive and backpressure-aware all the way down to the
database. It is intended primarily as a driver SPI to be consumed by client
libraries and not intended to be used directly in application code.


CLOUD READY

R2DBC supports cloud-native applications using relational databases such as
PostgreSQL, MySQL, and others. Application developers are free to pick the right
database for the job without being confined by APIs.


COMMUNITY

Join the R2DBC Community Forum to learn more about R2DBC, get your R2DBC
questions answered, and interact with other R2DBC developers.

 * DRIVERS
 * ClickHouse R2DBC Driver
 * Google Cloud Spanner
 * Jasync-sql MySQL
 * Oracle R2DBC Driver
 * R2DBC H2
 * R2DBC MariaDB
 * R2DBC MySQL
 * R2DBC PostgreSQL
 * R2DBC Proxy
 * R2DBC SQL Server

 * CLIENTS
 * jOOQ
 * Komapper
 * Kotysa
 * Micronaut
 * Querydsl
 * R2DBC Migrate
 * Spring Data R2DBC
 * Spring Boot
 * Testcontainers

 * CURRENT VERSION
 * Javadoc (1.0.0.RELEASE)
 * Specification (1.0.0.RELEASE)
 * PREVIOUS VERSION
 * Javadoc (0.9.1.RELEASE)
 * Specification (0.9.1.RELEASE)

 * COMMUNITY
 * GitHub
 * Twitter
 * Gitter
 * Stack Overflow
 * Mailing List
 * Email

R2DBC is licensed under the Apache Software License 2.

© 2018-2022 R2DBC Contributors | Code of Conduct