Configuring the Oracle JDBC drivers in a Helidon project

May 20, 2020 | 2 minute read
Text Size 100%:

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:

  • helidon-se with the bare minimum to get up to speed.
  • helidon-mp with MicroProfile integration to give you more bang for your buck.

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 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 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.

Andres Almiray

Previous Post

Adventures in CI/CD [#9]: Deploying A Microservice As A Docker Container

Todd Sharp | 4 min read

Next Post

Adventures in CI/CD [#10]: Deploying Our Microservice Docker Container To Kubernetes

Todd Sharp | 5 min read