Non blocking JDBC — Early 2021 update

Suchak Jani
4 min readFeb 7, 2021

--

Background

This is a Three part series

  1. Part One — A Case for Asynchronous Non Blocking JDBC — One
  2. Part Two — A Case for Asynchronous Non Blocking JDBC — Two
  3. Part Three — This page

In Part one we went through the details of non blocking calls and event based systems.

The Part two we went through Java NIO, Java JDBC, and the need for non blocking JDBC.

This this part we will understand the status of non blocking JDBC as of early 2021.

Sections on this page

  1. We will have a look at the R2DBC Project
  2. We will then have a look at Oracle’s stance on non blocking JDBC

R2DBC.IO

Key aspects

  1. Quoting from the website “The Reactive Relational Database Connectivity (R2DBC) project brings reactive programming APIs to relational databases”
  2. Supports various databases Google Cloud Spanner, MySQL, PostgreSQL, H2 , MariaDB, Microsoft SQL Server, r MySQL, PostgreSQL
  3. Has certain “Kotlin” based drivers. Love Kotlin.
  4. Does not have anything for Oracle.

Conclusion

JDBC has been a API standard for many many years.

There needs to be an Async Non Blocking Standard for JDBC.

R2DBC seems to fill this space.

Further Reading

See Appendix-1 for details on R2DBC

R2DBC plus Spring framework

Spring framework seems to have taken up the mantle of making it easy to work with reactive streams with its Flux, Mono, WebFlux projects.

Additionally now it works with R2DBC making it simple to work with reactive JDBC

Performance tests have consistently shown that WebFlux plus R2DBC is a great combination for all parameters like latency, throughput, CPU usage etc. Please see Appendix-2 for details.

Conclusion

R2DBC is a new API for reactive, non blocking Database access, across various databases.

This is not an Oracle supported project, more like a community effort.

However since it works well with Spring, it is worth considering

Further Reading

See Appendix-2 for details on Reactive Spring plus R2DBC

Oracle ADBA and R2DBC

Oracle had started a project sometime in 2018 to bring “Asynchronous Database Access API” to Oracle.

As of now this project has been discontinued.

Conclusion

Oracle does not seem to have a non blocking database access API , across many databases, like JDBC anymore.

Further Reading

See Appendix-3 for details on Oracle ADBA start and stop

Oracle JDBC Reactive Extensions

After Stopping ADBA, Oracle has come up with JDBC Reactive Extensions as a way to address Non Blocking Access to Oracle Database. As of now this is not a community wide Java Standard(Not a Non Blocking Java API for RDBMS access).

Oracle is convinced that this is the way forward. I have no idea as to why other database vendors are not included in this project.

Conclusion

Oracle has a released a way to perform non blocking access to the Oracle database as an extension in its JDBC drivers. As of now there is no Oracle Java effort to standardise non blocking API access to RDBMS like JDBC API.

Further Reading

See Appendix-4 for details on Oracle JDBC Extensions

Appendices

Appendix-1 — R2DBC

R2DBC

Supported databases by R2DBC

Maria R2DBC

PostgreSQL R2DBC

Appendix-2 —Reactive Spring plus R2DBC

Spring support for R2DBC

Spring webflux with R2DBC performance test

Appendix-3— ADBA START/STOP

Oracle ADBA Announcement — START

Oracle ADBA Announcement — STOP

Appendix-4— Oracle Reactive Extensions

Oracle Reactive Extensions presentations

Streams Fiber PDF-1

Streams Fiber PDF-2

Oracle Reactive Extensions documentation

--

--