Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • Feb 05 16:52
    renovate[bot] edited #582
  • Feb 05 16:51
    renovate[bot] opened #582
  • Feb 05 16:51

    renovate[bot] on configure

    Add renovate.json (compare)

  • Feb 02 15:12
    k163377 opened #581
  • Feb 02 15:12
    k163377 labeled #581
  • Jan 30 08:29
    mp911de commented #580
  • Jan 30 08:16
    akoufa commented #580
  • Jan 30 07:29
    mp911de labeled #580
  • Jan 30 07:29
    mp911de unlabeled #580
  • Jan 30 07:29
    mp911de commented #580
  • Jan 28 11:17
    akoufa labeled #580
  • Jan 28 11:17
    akoufa opened #580
  • Jan 27 16:27
    mwinkels-bol edited #578
  • Jan 27 14:53
    mwinkels-bol synchronize #579
  • Jan 27 12:26
    mwinkels-bol opened #579
  • Jan 27 12:20
    mwinkels-bol labeled #578
  • Jan 27 12:20
    mwinkels-bol opened #578
  • Jan 26 07:44
    mp911de assigned #274
  • Jan 26 07:44
    mp911de commented #274
  • Jan 26 07:40
    mp911de commented #181
Christophe Maillard
Is https://github.com/jasync-sql/jasync-sql the now recommended impl?
5 replies
Hi all, can anyone point me to some resources about using r2dbc with external connection pooler like pgbouncer or pgpool? What's the rule of thumb here?
Mark Paluch
The only thing to consider with external pooling is the handling of statement caching. There are config options to e.g. disable the statement cache if caching isn't performed by the connection pool server.
Jakub Czuchnowski
Hi there! Is there a plan for a new release of r2dbc-postgresql somewhere soon? The current main branch seems to have a fix for problem that's causing me headaches when using it in Scala
Hi team, i know some database doesn't support "Stream". So how R2DBC can "Fake" stream to make it reactive, except Postgre, I make sure Oracle, MySQL doesn't have "Stream"
Eyuel T Belay
How to handling relationships (1-1 or 1-M or M-M) in R2DBC it doesn't work for me? Is there equivalent annotation for @OneToOne(mappedBy = "ownedGame") or/and @JoinColumn(name="owned_game_id",referencedColumnName = "id") in spring webflux?
Hantsy Bai
@Eyueltb Micronaut support such features in Micronaut Data R2dbc, https://github.com/hantsy/micronaut-sandbox/tree/master/data-r2dbc-kotlin-co
Anders Clausen
Hi Mark @mp911de - any chance this PR can be merged r2dbc/r2dbc-pool#129. We had an issue using R2DBC + Postgresql and were lucky to discover this bug report and the workaround, however it's a shame it hasn't been merged yet.
4 replies
Danilo De Luca
Hi, I'm using r2dbc-postgresql and r2dbc-pool and I'm trying to configure 2 datasources: 1 for RW and 1 for RO instances. I tryed to configure it by creating a new DatabaseClient and ConnectionFactory explicit for RO and using default spring configuration for RW (by setting application properties), for some reason the connection pool is getting RO DatabaseClient/Connection too, is there some example to do that or to avoid pool to use this new connectionFactory(RO)?
2 replies
@mp911de can you please guide how to get io.r2dbc specific files by specifying org.postgresql groupid dependency in maven. Because when I am specifying org.postgresql:r2dbc-postgresql:1.0.0.RC1 in my maven then io.r2dbc files are not reachable in my project. Please help
1 reply

Hi Mark @mp911de,
Is there any way to customize the column selection in the named queries?

            "select a, b 
            from author a, book b
            where b.author_id = a.id and a.id in (:authorIds)"
    Flux<DummyProjection> findByAuthorIdIn(List<Integer> authorIds);

Even though Projection classes help if I know the column names during the design time, lets take GraphQL for example where the client specify the fields at run time.

So it would be nice, if we could support as shown here.

            "select a, b 
            from author a, book b
            where b.author_id = a.id and a.id in (:authorIds)"
    Flux<DummyProjection> findByAuthorIdIn(List<Integer> authorIds, Collection<String> columns);
7 replies
Zarko Stankovic
Hi everyone, I have a question regarding r2dbc-pool. Specifically, it's about "validationQuery" option. When this option is set, this query runs before any other query against the database. I've found out this in my DB logs. It is my understanding (from the docs) that this was supposed to be run only before acquiring a connection from the pool, not always, before any other query. My "initialSize" pool is 10 (default) and DB instance is running locally. No matter how many queries are executed against DB, it always runs "validationQuery" before anything else. Here's the code in r2dbc-pool https://github.com/r2dbc/r2dbc-pool/blob/2f21aacf877c9983ed1393d2d88f6c3d100d6e78/src/main/java/io/r2dbc/pool/ConnectionPool.java#L189-L192
Thanks in advance!
1 reply
Ling Hengqian
Just curious, while it is impossible to adopt the XA model, but have friends tried to put the LOCAL or BASE transaction model on R2DBC transactions? The thing I'm referring to is somewhat similar to transactional coordination of multiple data sources, i.e. distributed transactions.
Mark Paluch
There is no XA support for R2DBC drivers. For SQL Server at least, that would require additional messages and synchronization within the driver.
Ling Hengqian
Wow, thanks for the answer!
Hi All,
Just curious. Is there anyway to use Projection class/interface to convert the save entity response?
<T> Mono<T>  save(S entity);
Hi All,
I a new to r2dc, i am aware that it's used for asynchronous and non-blocking purpose.
My task is to insert/update the data into the DB using r2dbc but with synchronous and blocking way.
Can someone guide me on how to do it? Thanks :)
:point_up: Edit: Hi All,
I am new to r2dc, i am aware that it's used for asynchronous and non-blocking purpose.
My task is to insert/update the data into the DB using r2dbc but with synchronous and blocking way.
Can someone guide me on how to do it? Thanks :)
Mark Paluch

My task is to insert/update the data into the DB using r2dbc but with synchronous and blocking way.


1 reply

Hi All,
Trying to insert a string in a column which is enum inside postrgresql table. .bind("address_type", Parameter.fromOrEmpty(address.getHomeAddress().toString(), String.class))
Getting io.r2dbc.postgresql.ExceptionFactory$PostgresqlBadGrammarException: column "address_type" is of type addresstype but expression is of type character varying

HomeAddress is a enum here {HOME, OFFICE, OTHERS}

1 reply
Alexander Lindholm

Hey! I am trying to save an entity in a postgresdb with spring data that has an OffsetDateTime timestamp. It works fine in my dev environment but when I run it inside a docker container I get this exception:

Caused by: java.lang.ClassCastException: class java.time.OffsetDateTime cannot be cast to class java.time.LocalTime (java.time.OffsetDateTime and java.time.LocalTime are in module java.base of loader 'bootstrap')
    at io.r2dbc.postgresql.codec.BuiltinCodecSupport.encodeToText(BuiltinCodecSupport.java:83)
    Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Assembly trace from producer [reactor.core.publisher.MonoSupplier] :
Error has been observed at the following site(s):

I am not sure why as r2dbc postgres driver should have support for this datatype. Anyone have any suggestion to solve this issue?

2 replies
If anyone receives error while inserting enum value into postresql, use below format
INSERT INTO TABLE (enum_column_name) VALUES (CAST(:value as ENUM_type)); :)
Hello all, I've been trying to use postgreSql r2dbc in a project but I found 2 drivers io.r2dbc:r2dbc-postgresql and org.postgresql:r2dbc-postgresql which one is correct and do they have any differences in the performance?
Can any one help me with r2dbc connection pool, how this will handle 100rps with min pool size?
Jack Peterson
What's an appropriate way to persist to r2dbc from .doOnSuccess?
                        o -> {
                            // this method 
                                            .message("Updated contact information.")

private Mono<Event> logEventToDatabase(final Event event) {
        return this.eventRepository.save(event).publishOn(Schedulers.boundedElastic());
2 replies
I'd like to remove the publishOn and not be calling .subscribe(). Both subscribe() and .block() cause errors in terms of calling a blocking operation.

Hi everyone. I have recently upgraded r2dbc-postgresql to 0.9.1.RELEASE from 0.8.x. I have started getting Bound parameter count does not match parameters in SQL statement which was not the case with the previous version. below is how I am passing the parameters. Requesting team to help on this

    public Flux<Integer> unblockInventory(InventoryRequest request, boolean orderFulfilled) {
        return this.databaseClient.inConnectionMany(connection -> {
            var statement = connection.createStatement(UNBLOCK_INVENTORY_QUERY);
            for (var item : request.getOrderItems()) {
                        .bind(0, request.getSource() == UpdateSource.AMAZON ? item.getQuantity() : 0)
                        .bind(1, request.getSource() == UpdateSource.APOLLO247 ? item.getQuantity() : 0)
                        .bind(2, orderFulfilled ? 1 : 0)
                        .bind(3, Utility.getKey(item.getSku(), request.getStoreId()))
                        .bind(4, request.getAxdcCode())
            return Flux
                    .map(e -> {
                        if (e == 0) {
                            throw new InventoryNotUnblockedException(request.toString());
                        return e;
                    .doOnError(ex -> LOGGER.error(() -> MessageUtils.errorMessage(Event.UNBLOCK_INVENTORY_FAILED,
                            ex.getMessage(), ex, false)));

below is the query

    private static final String UNBLOCK_INVENTORY_QUERY = """
            UPDATE item_inventory AS iv
                amazon_reserved = CASE
                                    WHEN (iv.amazon_reserved - $1) < 0 THEN 0 ELSE iv.amazon_reserved - $1
                apollo_reserved = CASE
                                    WHEN (iv.apollo_reserved - $2) < 0 THEN 0 ELSE iv.apollo_reserved - $2
                quantity = CASE
                            WHEN $3 = 1 THEN iv.quantity - $1 - $2 ELSE iv.quantity
                version = iv.version + 1,
                updated_at = NOW()      
            WHERE id = $4 AND iv.axdc_code = $5      

This is after I have updated to

Caused by: dev.miku.r2dbc.mysql.client.MySqlConnectionClosedException: Connection closed at dev.miku.r2dbc.mysql.client.ClientExceptions.expectedClosed(ClientExceptions.java:36) ~[r2dbc-mysql-0.8.2.RELEASE.jar!/:0.8.2.RELEASE]
Connection was closed after some time.
My Pool Configuration::
ConnectionPoolConfiguration configuration = ConnectionPoolConfiguration.builder(ConnectionFactories.get(optionsAcc))
// .maxCreateConnectionTime(Duration.ofSeconds(10))
// .maxAcquireTime(Duration.ofSeconds(10))
.validationQuery("SELECT 1")
@sushovan24 Turns out that you must not call .add() on the last element in the iteration.
How do we use useUnicode=true&characterEncoding=UTF-8 in r2dbc-spi url

Database calls are getting stuck. not sure whether they are making to DB host or not, but seeing below log statement when i enable TRACE logs on io.r2dbc package after that nothing

491156 --- [or-http-epoll-5] io.r2dbc.mssql.QUERY [ 250] : Executing query: select column_1, column_2 from table where column_3 = 123

Using Springboot 2.7.2 with following


''return databaseClient.sql("select column_1, column_2 from table where column_3 = :value)
.bind("value", "123")
.first().flatmap(res -> return Mono.just(res));''

did any one face/saw similar issue? what could be the problem

1 reply
hello, I am trying to find whether there is a sequence generation support with r2dbc (like with hibernate @GeneratedValue with jdbc)? Thank you.

@inpeace_gitlab This is solve there is a conflict between connect_timeout and idleTimeOut. idleTimeOut <= connect_timeout.

But now when there is any error occurred then mysql error 1129 coming.

org.springframework.dao.DataAccessResourceFailureException: Failed to obtain R2DBC Connection; nested exception is io.r2dbc.spi.R2dbcNonTransientResourceException: [1129] Host '<myip>' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts')

Andreas Arifin
Hi All. I want to ask about minIdle behavior on the r2dbc-pool. I have set this option on my project and my expectation was it will behave same like HikariCP where the idle size will be maintained at the configured size no matter how long the app run. But it is not the case here. First try, the connection count dropped to zero after 30 minutes. We found that it's because of maxIdleTime was default to 30 mins. We set it to -1 to remove eviction behavior. It was looking good at the surface because the connection count stayed at the configured size. But when we tried to access the DB from our app, it seems the connection is hanging: it stays at the configured size, but seems to lose the connection to the db because the process got timed out. It is known issue or my expectation was wrong about the minIdle behavior?
2 replies

Hi All. Getting below error when trying to use reactor-test

13:36:18.316 [Test worker] DEBUG reactor.core.publisher.Operators - Duplicate Subscription has been detected
java.lang.IllegalStateException: Spec. Rule 2.12 - Subscriber.onSubscribe MUST NOT be called more than once (based on object equality)
            .verifyComplete(); --- error comes in this line

I am using smae thread pool in different classes as @Qualifier

Panusitt Khuenkham

Sorry, I have a problem, please help.

I have a problem in below,

[1;31m[ERROR][2022-09-07T19:20:19,078][reactor-tcp-epoll-2][][BaseExceptionHandler] causeMsg: Request queue is full

Spring Boot: 2.6.10


Thank you so much
I try add -Dreactor.bufferSize.small=4096
But I don't know if it can be fixed in the long term.
Can you suggest a solution for me?
Panusitt Khuenkham
What should I calculate from?
Hello everybody, is it possible to stream a file (byte array, or from FilePart.class) into a traditional relational database without loading the whole file into memory ?
Mark Paluch
Only with some databases. It depends whether the entire protocol frame must be assembled first (e.g. to calculate its size). SQL Server should work with streaming.
Guys, new to the room. Wanted to ask something i am struggling with on r2dbc pool. I want to pass acquire-retry param to r2dbc pool config from my yaml but i was not able to. I tried adding programatically referring the documentation and all looks good but my initial size doesn't reflect on my postgres query to check number of connections.
    public ConnectionFactory connectionFactory() {
        ConnectionFactory connectionFactory = ConnectionFactories.get(ConnectionFactoryOptions.builder()
                .option(DRIVER, "pool")
                .option(PROTOCOL, "postgresql")
                .option(HOST, host)
                .option(PORT, port)
                .option(USER, userName)
                .option(PASSWORD, password)
                .option(DATABASE, dbName)

        ConnectionPoolConfiguration configuration = ConnectionPoolConfiguration.builder(connectionFactory)
                .metricsRecorder(new R2DBCPoolMetrics())
        ConnectionPool connectionPool= new ConnectionPool(configuration);
        return connectionPool;
This looks good but if i check num of connections in postgres it doesn't reflect initialSize i pass here
Mark Paluch
You need to call the warmu() method to pre-initialize the pool
Question: is there a version dependency between r2dbc spi & core?
I am asking because of jasync-sql/jasync-sql#310
Also is someone can help me setup a basic integration test for the r2dbc module that would be great
5 replies
Mahender Gusain
Need to understand maxValidationTime( r2dbc connection pool ConnectionPoolConfiguration)?? Is it good to override maxValidationTime=200. or Is it good to keep it default.?
1 reply