Questions tagged [r2dbc]

R2DBC (Reactive Relational Database Connectivity) is an SPI which enables interacting with SQL database servers by executing SQL statements using a non-blocking reactive programming model with the Java programming language.

R2DBC is a Java-based, open source data access technology.

This technology is an SPI (Service Provider Interface) for the Java programming language that defines how a client may access a database using reactive programming. It specifies SPI methods for executing queries using a non-blocking driver. R2DBC is oriented towards relational databases.

Online resources

379 questions
3
votes
1 answer

How do I create JOOQ DSLContext from reactive MariaDB connection

JOOQ manual states the following: Out of the box, all jOOQ provided publishers will block on the underlying JDBC connection, but if you provide jOOQ with a io.r2dbc.spi.Connection or io.r2dbc.spi.ConnectionFactory, then the publishers will execute…
Kirill Kazoolin
  • 223
  • 1
  • 3
  • 12
3
votes
1 answer

Why does the annotation @Transactional not work in the case of custom AbstractR2dbcConfiguration

Recently I was learning r2dbc and encountered a problem. In order to test transactions in r2dbc, I wrote a small test project. sample code github You can see the correct code on the master branch and the wrong code on the zd/transactional-test…
xuelai
  • 55
  • 6
3
votes
1 answer

r2dbc-oracle back pressure implementation vs. fetchsize

it seems that the r2dbc-oracle doesnt have a proper back pressure implementation. If i select a bigger amoount of rows (say 10k) then it is way slower than a regular jdbc/JPA query. If i manually set the fetchsize to 1000 then the query is approx 8…
3
votes
1 answer

R2DBC can be used for change data capture in Spring boot?

I have a classic Spring Boot Application connected to a MySQL database. Can I use r2dbc driver and spring data r2dbc to develop another application that listens to the database changes like a change data capture? I've studied the r2dbc driver…
3
votes
1 answer

How can exception if mono is empty?

I use webflux and r2dbc. If there is a duplicate value in DB, I want to throw an error. Handler.java Mono save(ServerRequest request) { return request.bodyToMono(User.class) .flatMap(user->…
HooMin.Lee
  • 115
  • 1
  • 8
3
votes
1 answer

How to implement ManyToMany in r2dbc

R2DBC does not support composite keys currently. I wonder how we may implement a many-to-many relationship for now? For example, given the two entities: @Table class Item( @Id var id: Long?, var title: String, var description:…
Stuck
  • 11,225
  • 11
  • 59
  • 104
3
votes
0 answers

Spring Data R2DBC mysql - Log query and query parameter

I am using Spring data r2dbc for mysql. implementation 'org.springframework.boot:spring-boot-starter-data-r2dbc' runtimeOnly 'dev.miku:r2dbc-mysql' runtimeOnly 'mysql:mysql-connector-java' I am able to print the query using the below log…
user1578872
  • 7,808
  • 29
  • 108
  • 206
3
votes
1 answer

Spring R2DBC: How to replace deprecated DatabaseClient.as(…) and handle custom types/converters for jsonb field

I have a problem with objects mapping after migrating to Spring Boot 2.4. So far I was using Spring Boot 2.3 (with Kotlin). For the sample database query override fun findMyEntities(searchParams: SearchParams): Flux = …
Pawel
  • 466
  • 1
  • 7
  • 20
3
votes
3 answers

initialize database for testing purpose on Spring Data R2DBC

In a non-test environment, I can set up the bean to initialize the database with the schema.sql like this @Bean ConnectionFactoryInitializer initializer(@Qualifier("connectionFactory") ConnectionFactory connectionFactory) { …
kamalhm
  • 126
  • 2
  • 10
3
votes
0 answers

google cloud proxy r2dbc mysql driver to connect mysql on google encounter closed connection with bad certificate after a while

I'm writing a POC with spring webflux and google r2dbc cloud sql proxy connector for MySql. Things worked pretty smooth until I'm running a long stress test. After about 40 minutes or so, I kept getting connection closed due to the bad certificate…
MichaelH
  • 31
  • 3
3
votes
1 answer

When using Spring R2DBC repositories can I provide my own custom R2dbcEntityTemplate?

I can make required tweaks via: @EnableR2dbcRepositories(repositoryBaseClass = BaseRepo::class) but this is too high level. Essentially I override top level method with custom behaviour which needs to be done at R2dbcEntityTemplate.class level so…
Aubergine
  • 5,862
  • 19
  • 66
  • 110
3
votes
2 answers

How does a R2DBC repository work with Postgis geometries?

I had a couple of entity classes that worked with Spring Data JPA. (These entity classes are in a postgres db with postgis installed and contain geometry fields.) However, when I switched to r2dbc, it did not work. Any pointers will be…
Tisha
  • 827
  • 3
  • 11
  • 34
3
votes
1 answer

Connect with MSSQL with Spring Reactive (R2DBC)

I am currently trying to establish a database connection with a Microsoft SQL Server. Unfortunately I can not understand why it does not work. And the error message can unfortunately not give me precise information. It looks like my code isn't even…
kemal
  • 41
  • 2
  • 7
3
votes
0 answers

How to convert ByteReadChannel into Flow

How can I convert io.ktor.utils.io.ByteReadChannel into kotlinx.coroutines.flow.Flow? I use Ktor with this routing: post("/upload") { val channel: ByteReadChannel = call.receiveChannel() val flow:…
Zoltán
  • 61
  • 4
3
votes
0 answers

Application.properties and r2dbc

I use spring boot 2.2 with spring cloud Hoxton.SR1. I don't have any config class for my db. I only have an application.properties to setup database. In my application.properties, I…
robert trudel
  • 5,283
  • 17
  • 72
  • 124