Code Monkey home page Code Monkey logo

r2dbc.github.io's Introduction

r2dbc.github.io's People

Contributors

0xflotus avatar arron-shin avatar dependabot[bot] avatar eyelash avatar fifthposition avatar gregturn avatar jponge avatar maciejwalkowiak avatar mirromutth avatar mp911de avatar nakamura-to avatar oshai avatar rodrigolgraciano avatar shinjonathan avatar technical-debt-collector avatar ttddyy avatar valery1707 avatar zhicwu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

r2dbc.github.io's Issues

New R2DBC Driver for IBM DB2

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.

Thanks!
Jason Edwards
GitHub | LinkedIn

R2DBC.io initial example should properly manage resources

Feature Request

Is your feature request related to a problem? Please describe

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.

Describe the solution you'd like

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.

Mutiny example is incorrect

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();
  1. Instead of starting from a Uni converted to a Multi, you could start with Multi.createFrom().(...)
  2. we do have flatMap, but onItem().transformTo{...} makes for more readable code,
  3. onItem().invoke(...) can indeed be used to consume elements, but you should do it in the subscription final handler,
  4. speaking of the subscription this code for sure does nothing, 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.