Get the dependent JARs to use with the Oracle JDBC driver using “ojdbc-bom”
The Oracle JDBC Driver (ojdbc17.jar or ojdbc11.jar , or ojdbc8.jar) requires other dependent libraries for additional functionalities. For example, if you want to use Oracle Wallets to establish connections to the Oracle Autonomous Database (ADB), then oraclepki.jar is required in the class path along with the Oracle JDBC driver. Similarly, for connection pooling capabilities, ucp.jar should be in the classpath. Managing the Oracle JDBC driver along with these dependent jars, such as ucp.jar, ons.jar, simplefan.jar, oraclepki.jar, xdb.jar, xmlparserv2.jar, orai18n.jar, can be a difficult task, especially when you want to make sure that all jars are from the same version. Oracle’s ojdbc-bom (Bill of Materials) simplifies this process by providing a way to manage dependency versions using an ojdbc-bom-<version>.pom file. The BOM file defines the list of artifacts available in the release, leaving it to the Java developers the liberty to pick and choose the ones they want. The details on how to use the BOM are elaborated in this blog.
What is ojdbc-bom?
The ojdbc-bom-<version>.pom file is Oracle’s Bill of Materials (BOM) that manages version compatibility across the Oracle JDBC driver and the other complementary libraries. A BOM is a Maven concept that allows central management of dependency versions across multiple artifacts, ensuring that all components work together seamlessly.
The BOM acts as a single source of truth for a set of compatible dependency versions within a project. It helps in reducing version conflicts, simplifies dependency management, and improves maintainability. The ojdbc-bom is available for all the released database versions of 19c, 21c, and 23ai. Refer to the Maven Central repository for accessing different versions. Refer to Maven Central Developer Guide for understanding the use cases on when to use the additional jars.
Dependencies available in the Oracle JDBC driver BOM 23ai (ojdbc-bom-23.9.0.25.07.pom):
JDBC Drivers and Connection Pool:
- JDBC drivers:
ojdbc17.jar, ojdbc11.jar, and ojdbc8.jar - Connection Pool Library:
ucp17.jar, ucp11.jar and ucp.jar– Universal Connection Pool - Bundled Production JARs:
ojdbc17-production.pom, ojdbc11-production.pom, ojdbc8-production.pom– Downloads the Oracle JDBC driver along with its companion jars.
Security Related:
- Security Library:
oraclepki.jar– The Oracle PKI provider used for Oracle wallets
High Availability Related:
- High Availability (HA) Libraries:
ons.jar– (Oracle Notification Service) andsimplefan.jar(Simplified Fast Application Notification)
Advanced Features:
- Library for ingesting High Volume data:
rsi.jar– Reactive Streams Ingest – A dedicated path for ingesting high volume of data into the Oracle database. - Internationalization Library:
orai18n.jar– Java classes for NLS or Internationalization support - XML Parser Libraries:
xdb.jar, and xmlparserv2– Support for the JDBC 4.x standard java.sql.SQLXML interface and the Oracle Database XML Parser library
Bundled Production JARs and their purpose:
The ojdbc-bom file has bundled production JARs ojdbc17-production.pom, ojdbc11-production.pom, and ojdbc8-production.pom. These production JARs add the flexibility to download all the complementary libraries along with the Oracle JDBC driver in one go for faster access. You don’t have to download each additional dependent jar one at a time.
- ojdbc17-production: will pull ojdbc17.jar, ucp17.jar, oraclepki.jar, rsi.jar, ons.jar, simplefan.jar, xdb.jar, and xmlparserv2.jar
- ojdbc11-production: will pull ojdbc11.jar, ucp11.jar, oraclepki.jar, rsi.jar, ons.jar, simplefan.jar, xdb.jar, and xmlparserv2.jar
- ojdbc8-production: will pull ojdbc8.jar, ucp.jar, oraclepki.jar, rsi.jar, ons.jar, simplefan.jar, xdb.jar, and xmlparserv2.jar
The Oracle JDBC driver BOM and dependent libraries in different releases:
The list of artifacts that the BOM file offers differs between the versions 23ai, 21c, and 19c. This change is due to the introduction of new features that eliminate the need for some additional jars. Example, 23ai requires only oraclepki.jar in the classpath for using Oracle Wallets. However, in the older versions 19c and 21c, oraclepki.jar, osdt_cert.jar, and osdt_core.jar were required to use Oracle Wallets. Similarly, 23ai adds the debugging capabilities in the main production jar, eliminating the need to use ojdbcx_g.jar, ojdbcxdms.jar, and ojdbcxdms_g.jar. See the list below to get an idea of the artifacts that are present in the ojdbc-bom file.
- 23ai:
ojdbc17.jar (certified with JDK17, JDK19, and JDK21), ucp17.jar (certified with JDK17, JDK19, and JDK21), ojdbc17-production.pom
ojdbc11.jar (certified with JDK11 and JDK21), ucp11.jar (certified with JDK11 and JDK21), ojdbc11-production.pom
ojdbc8.jar (certified with JDK8 and JDK11), ucp.jar (certified with JDK8 and JDK11), ojdbc8-production.pom
rsi.jar, oraclepki.jar, ons.jar, simplefan.jar, xdb.jar, and xmlparserv2.jar - 21c:
ojdbc11.jar (certified with JDK17, JDK19, and JDK21), ucp11.jar (certified with JDK11, JDK17, JDK19, and JDK21), ojdbc11-production.pom
ojdbc8.jar (certified with JDK11 and JDK21), ucp.jar (certified with JDK8), ojdbc8-production.pom,
ojdbc11_g.jar, ojdbc8_g.jar, ojdbc11-debug.pom, ojdbc8-debug.pom,
ojdbc11dms.jar, ojdbc8dms.jar, dms.jar, ojdbc11-observability.pom, ojdbc8-observability.pom
ojdbc11dms_g.jar, ojdbc8dms_g.jar, ojdbc11-observability-debug.pom, ojdbc8-observability-debug.pom
rsi.jar, oraclepki.jar, osdt_core.jar osdt_cert.jar, simplefan.jar, ons.jar, rsi.jar, xdb.jar, xmlparserv2.jar - 19c:
ojdbc10.jar (certified with JDK11, JDK17, JDK19, and JDK21), ucp11.jar (certified with JDK11, JDK17, JDK19, and JDK21), ojdbc11-production.pom
ojdbc8.jar (certified with JDK8, JDK11, JDK19, JDK17, and JDK21), ucp.jar (certified with JDK8, JDK11, JDK17, JDK19, and JDK21), ojdbc8-production.pom,
ojdbc10_g.jar, ojdbc8_g.jar, ojdbc10-debug.pom,ojdbc8-debug.pom,
ojdbc10dms.jar, ojdbc8dms.jar, dms.jar, ojdbc10-observability.pom, ojdbc8-observability.pom
ojdbc10dms_g.jar, ojdbc8dms_g.jar, ojdbc10-observability-debug.pom, ojdbc8-observability-debug.pom
oraclepki.jar, osdt_core.jar osdt_cert.jar, simplefan.jar, ons.jar, rsi.jar, xdb.jar, xmlparserv2.jar
Setting Up ojdbc-bom in Maven
1. Add the BOM to Your POM
First, add the ojdbc-bom to your dependencyManagement section as shown below. The tags <type>pom</type> and <scope>import</scope> are very important. Adding an ojdbc-bom dependency doesn’t guarantee adding all the dependent JARs to the classpath. You will need to explicitly add the required dependent library using the <dependency> section as shown in the step 2.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc-bom</artifactId>
<version>23.9.0.25.07</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
2. Add Oracle Dependencies Without Versions
In your project POM file, add the Oracle dependencies that you need for your application without specifying versions:
<dependencies>
<!-- Oracle JDBC Driver -->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc17</artifactId>
</dependency>
<!-- Universal Connection Pool for connection pooling capabilities-->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ucp17</artifactId>
</dependency>
<!-- Oracle Wallet for Mutual TLS Connections -->
<dependency>
<groupId>com.oracle.database.security</groupId>
<artifactId>oraclepki</artifactId>
</dependency>
<!-- Bundled Production JDBC JAR for pulling all the complementary JARs in one go-->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc17-production</artifactId>
</dependency>
</dependencies>
Setting Up ojdbc-bom in Gradle
For Gradle projects, use the following configuration.
dependencies {
implementation platform('com.oracle.database.jdbc:ojdbc-bom:23.9.0.25.07')
implementation 'com.oracle.database.jdbc:ojdbc17'
implementation 'com.oracle.database.jdbc:ucp'
implementation 'com.oracle.database.security:oraclepki'
}
Example: Complete Spring Boot Configuration
This is an example of using ojdbc-bom in a Spring Boot application:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<relativePath/>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc-bom</artifactId>
<version>23.9.0.25.07</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc17</artifactId>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ucp17</artifactId>
</dependency>
</dependencies>
</project>
Conclusion
Using ojdbc-bom simplifies Oracle JDBC dependency management in Java projects, and the BOM approach scales well from simple applications to complex enterprise systems. As a best practice, make sure to check for the latest quarterly releases and update ojdbc-bom to use the latest version of the Oracle JDBC driver and other complementary libraries.
Refer to the Maven Central repository for accessing different versions of the Oracle JDBC driver and other jars. Refer to Maven Central Developer Guide for understanding the use cases on when to use the additional jars. For all the other product related resources, check out the page www.oracle.com/jdbc.
