In a previous post I showed how to get started with the Oracle JDBC drivers and Oracle UCP on a regular Java application. In this post I'll continue by showing integration of these technologies with microservices and application frameworks, starting with those that provide built-in support.Note: As time passes by it may be the case that some of the frameworks shown offer explicit support for configuring the Oracle JDBC drivers and UCP. This post depicts the current state of affairs as of May 2020.
In their own words, Helidon is a collection of Java libraries for writing microservices. There are two flavors to choose from:
The recommended approach to create Helidon projects is explained in the quickstart guides linked above. If you chose helidon-se as your starting point then the instructions found in the previous post should work as well. You can also create a Helidon powered MicroProfile project by browsing to https://start.microprofile.io/ and selecting Helidon as the chosen runtime. Once you have a Helidon project the next step is to configure the required dependencies for Oracle JDBC and UCP.
Helidon provides an MP extension for these technologies, which means the following steps work best if your Helidon application is based on helidon-mp. First, add a dependency on your POM to helidon-integrations-cdi-datasource-ucp as shown next
You only need the single dependency to begin with. However should you need to use a different version for the drivers (the default version defined by Helidon 2.0 is 184.108.40.206) then you can override it by defining a build property named version.lib.ojdbc8, no need to write down additional dependencies in the <dependencies> block!Once this step is completed you can configure the datasource and inject it at the required locations as shown in UCP's extension page. There is really not much to it, getting started with Helidon and the Oracle JDBC drivers is a breeze.