Break New Ground

Configuring the Oracle JDBC drivers in a Helidon project

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

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.