Common R2DBC Resources
This repository contains common resources for R2DBC projects. These are in particular:
R2DBC site
Home Page: https://r2dbc.io/
The website uses an incorrect Postgres dependency name r2dbc-postgres
it should be r2dbc-postgresql
https://r2dbc.io/2022/02/04/r2dbc-borca-released
https://r2dbc.io/drivers/
At the bottom of the websites, e.g. https://r2dbc.io, there's a Code of Conduct link that points here:
https://github.com/r2dbc/r2dbc-spi/blob/main/CODE_OF_CONDUCT.adoc
This document seems to no longer exist.
We have a new maintainer for the MySQL driver, so updating the website reference.
See also mirromutth/r2dbc-mysql#251
Hello R2DBC team!
I'd like to bring to your attention a new R2DBC driver for the IBM DB2 database, which I implemented while working at USAA and was just open-sourced at https://github.com/usaa/reactive-db-bridge. I am no longer employed by USAA, but would be happy to answer any questions about the driver, or connect your team with the appropriate folks still over at USAA.
Show a table listing key features of R2DBC and drivers that implement them.
It is not immediately obvious to new users how to best manage resources with R2DBC, see e.g. my previous message:
https://groups.google.com/g/r2dbc/c/a7CQAU_u_m0
The example on the website is no help either, as it produces a resources leak:
https://r2dbc.io
The Connection
is never closed:
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();
The same problem in https://github.com/r2dbc/r2dbc-pool/blob/main/README.md, where the resource is closed, but it is left as an exercise to the reader how to actually do that in a reactive stream:
// later
Connection connection = …;
Mono<Void> release = connection.close(); // released the connection back to the pool
Given the trouble discussed in the mailing list, e.g. when intercepting cancel
events, too, I think this is quite the pitfall for new users evaluating R2DBC.
I'd love to see resource management examples on at least:
I'd love to provide a PR, but I don't feel I'll produce the correct solution yet, using reactor or Rx or other APIs. The groups discussion above hinted at using usingWhen
, perhaps similar to this change here in the oracle driver?
r2dbc/r2dbc-spi@e8de1bc
Alternatively, the r2dbc.io homepage example could avoid using a pool, in case of which resource management is out of scope for the example. But I still think that this very important question should be answered very early on when someone looks at R2DBC for the first time.
Hi,
Looking at the Mutiny example on the front page there are many issues, including:
ConnectionFactory connectionFactory = ConnectionFactories
.get("r2dbc:h2:mem:///testdb");
Uni.createFrom().publisher(connectionFactory.create())
.toMulti()
.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)))
.on()
.item().invoke(firstname -> System.out.println(firstname))
.subscribe();
Uni
converted to a Multi
, you could start with Multi.createFrom().(...)
flatMap
, but onItem().transformTo{...}
makes for more readable code,onItem().invoke(...)
can indeed be used to consume elements, but you should do it in the subscription final handler,subscribe()
must be followed by a subscription, like .subscribe().with(...)
/ .subscribe().withSubscriber(....)
, etc.Is there any actual example somewhere to compile and test what you intend to show on the front page?
As it is now the Mutiny sample lacks correctness and idiomatic usage of the APIs we provide.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.