Open source relational database MariaDB has released its Reactive Relational Database Connectivity (R2DBC) Connector to general availability this week, bringing Java developers the ability to integrate reactive interactions with MariaDB into their new and existing reactive applications.
Until now, Java developers using MariaDB have had to rely on the Java Database Connectivity (JBDC) API, first released more than 20 years ago. The problem with JDBC is that it hasn’t necessarily kept pace with development methods, such as reactive programming, which uses asynchronous data streams. JDBC is a blocking API, which means that when a request is made, it remains busy until the response is provided. R2DBC, by contrast, is non-blocking, which means requests can be made and responded to while others are pending. With the addition of R2DBC, Rob Hedgpeth, director of developer relations at MariaDB, says that its users can now more easily enjoy certain benefits seen with other types of databases.
“This is really important for relational databases because this is kind of the catch-up point to some of the more NoSQL approaches. Things like MongoDB or Couchbase have had event-driven, or what we commonly refer to as reactive, interactions baked into them,” said Hedgpeth. “That was one of the advantages of the NoSQL movement, taking a look at the way things are, what was possible in a relational environment, and being able to add that to more of a NoSQL approach. This is an answer to that from the relational database side within the Java ecosystem.”
MariaDB’s R2DBC connector is an implementation of the R2DBC specification, which aspires to provide Java developers with an “event-driven, non-blocking and functional programming model that does not make assumptions over concurrency or asynchronicity,” according to that specification.
With JDBC, explained Hedgpeth, the developer has to handle spinning up multiple threads and managing the context, which he says is something they would rather not do.
“R2DBC’s focus is essentially trying to limit that, trying as much as you can to limit the thread count to one, essentially, and say, ‘Hey, I really just want to take advantage of the resources as much as I can,'” said Hedgpeth. “The MariaDB driver helps facilitate that.”
He further explained that R2DBC makes reactive programming exceedingly accessible by using popular APIs and libraries.
“The simplicity stems from R2DBC specification’s use of the Reactive Streams API, which is a very popular reactive programming library specification designed for handling asynchronous data streams using event-driven interactions that support an idea known as non-blocking back pressure,” explained Hedgpeth. “Basically this means that developers can use any Reactive Streams library implementation, such as Project Reactor or RxJava, they’d like in combination with R2DBC. So, whether developers are planning to create a new reactive solution or looking to swap out their MariaDB Connector/J (JDBC) driver they can do this very easily using MariaDB Connector/R2DBC.”
In addition to the release of the R2DBC connector, MariaDB also unveiled a Developer Hub, which includes how-tos and code samples, as well as step-by-step instructions on how to get started with R2DBC. The MariaDB Connector/R2DBC is available for download and through the Maven repository and MariaDB will be offering a webinar on creating fully reactive applications using R2DBC on Jan. 13 at 10 a.m. PT and 4 p.m. CET.