Developers Guide For Oracle JDBC 21.1.0.0 on Maven Central

Developers Guide For Oracle JDBC on Maven Central

What are the changes ?

The Oracle JDBC drivers jars can be used in isolation however, depending on use cases, additional/companion jars are required. Starting from 19.7.0.0 release, we move the packaging on Maven Central from pre-established dependencies between artifacts to giving Java developers a choice between "pick-and-choose" (a.k.a. DIY) using a BOM, and "pre-established" dependencies models. The goal of this page is to help you pick the right model and the appropriate artifacts based on your use cases. Refer to Getting Started for instructions to create a maven project. The Oracle JDBC driver versions that are posted on Central Maven are: 11.2.0.4, 12.2.0.1, 18.3.0.0 and its quarterly releases, 19.3.0.0 and its quarterly releases, 21.1.0.0 and its quarterly releases, and 23ai release. All the released artifacts are at this maven repository. You can always download the latest Oracle JDBC drivers and other artifacts from JDBC Download Page. You can also get the older release and quarterly updates of Oracle JDBC drivers from Oracle JDBC Drivers Archive

Changes in Oracle JDBC 23ai Release

Starting with Oracle JDBC 23ai, the diagnosability is simplified and eliminates the need to switch to debug jar files. The enhanced diagnosability works with ojdbc8.jar or ojdbc11.jar in the class path and it does not require any of the additional debug jars ojdbc8_g.jar, ojdbc8dms.jar, ojdbc8dms_g.jar, ojdbc11_g.jar, ojdbc11dms.jar, ojdbc11dms_g.jar and hence, these are not present in 23ai. Similarly, you need only ojdbc8-production and ojdbc11-production to pull the JDBC driver along with other companion jars for diagnosability and observability features.

List of Artifacts (BOM)

Artifact Name Group Name Artifact Description
ojdbc8.jar com.oracle.database.jdbc Supports JDBC 4.2 spec and for use with JDK8 and JDK11
ojdbc11.jar com.oracle.database.jdbc Supports JDBC 4.3 spec and for use with use with JDK8, JDK11, JDK17, JDK19, and JDK21
ojdbc10.jar com.oracle.database.jdbc Supports JDBC 4.3 spec and for use with JDK 11 and JDK 17. Available only in 19c version.
ucp.jar com.oracle.database.jdbc The Java Universal Connection Pool for Oracle Database
ucp11.jar com.oracle.database.jdbc The Java Universal Connection Pool for Oracle Database compiled with JDK11. (Starting with 21c release).
rsi.jar com.oracle.database.jdbc A dedicated path for ingesting high volume of data into Oracle database. (Starting with 21c release).
ojdbc8dms.jar com.oracle.database.observability Same as ojdbc8.jar but includes Dynamic Monitoring Service (DMS) instrumentation and requires dms.jar in the classpath. (Not required if you are using 23ai)
ojdbc11dms.jar com.oracle.database.observability Same as ojdbc11.jar but includes Dynamic Monitoring Service (DMS) instrumentation and requires dms.jar in the classpath. (Not required if you are using 23ai)
dms.jar com.oracle.database.observability The Oracle Dynamic Monitoring System (i.e., observability) library
ojdbc8_g.jar com.oracle.database.jdbc.debug Same as ojdbc8.jar except compiled with -g option; for dev and test. (Not required if you are using 23ai)
ojdbc11_g.jar com.oracle.database.jdbc.debug Same as ojdbc11.jar except compiled with -g option; for dev and test. (Not required if you are using 23ai)
ojdbc8dms_g.jar com.oracle.database.jdbc.debug Same as ojdbc8dms.jar except compiled with -g option; for dev and test. (Not required if you are using 23ai)
ojdbc11dms_g.jar com.oracle.database.jdbc.debug Same as ojdbc11dms.jar except compiled with -g option; for dev and test. (Not required if you are using 23ai)
oraclepki.jar com.oracle.database.security The Oracle PKI provider used for Oracle wallets
osdt_cert.jar com.oracle.database.security The certificate management components used for Oracle Wallets. (Not required if you are using 23ai)
osdt_core.jar com.oracle.database.security The core components between oraclepki.jar and osdt_cert.jar. (Not required if you are using 23ai)
orai18n.jar com.oracle.database.nls Java classes for NLS or Internalization support
ons.jar com.oracle.database.ha Oracle Notification System (ONS) library for FAN events
simplefan.jar com.oracle.database.ha Simple Fast Application Notification (FAN) library
xdb.jar com.oracle.database.xml Support for the JDBC 4.x standard java.sql.SQLXML interface. Note: xdb6.jar is a legacy name, xdb.jar is the new name
xmlparserv2.jar com.oracle.database.xml The Oracle Database XML Parser library
xmlparserv2_sans_jaxp_services com.oracle.database.xml The Oracle Database XML Parser library

Pre-established Dependencies

The pre-established model is hassle-free and gives you all the artifacts you would need for the most common use cases including: production, production with debug instrumentation, observability and observability with debug instrumentation. If you are looking for picking and choosing the artifacts from the bill of materials (BOM), please skip this section and go to "DIY using the BOM file".

Pre-established Use Cases

  • Pre-requisites: Choose the JDBC driver based on JDBC Spec and JDK version

    The first thing is to determine which JDBC Specification and JDK you intent to use the drivers and companion jars for.
    Note: Starting with Oracle JDBC 23ai, ojdbc8.jar and ojdbc11.jar have diagnosability and observability capabilities built into them. So, ojdbc8-production and ojdbc11-production are the only two that customers need to pull Oracle JDBC driver along with its companion jars.

    Name Description
    ojdbc8-production, ojdbc8-debug, ojdbc8-observability, ojdbc8-observability-deb ug Support the JDBC 4.2 Spec and can be used with JDK8 and JDK11
    ojdbc10-production, ojdbc10-debug, ojdbc10-observability, ojdbc10-observability- debug Support the JDBC 4.2 Spec and can be used with JDK10 and JDK 11. (Only for 19c Release)
    ojdbc11-production, ojdbc11-debug, ojdbc11-observability, ojdbc11-observability- debug Support the JDBC 4.2 Spec and can be used with JDK11 and JDK17. Starting from 21c release.
  • Use Case 1: I Want the Production Jars

    These jars are optimized for production use (development, test, deployment), no instrumentation for debugging or observabiity. Depending on the desired JDBC Spec and JDK (Pre-requisites), you have the choice between ojdbc8-production or ojdbc11-production

    • ojdbc8-production:will pull ojdbc8.jar, ucp.jar, oraclepki.jar, osdt_core.jar, osdt_cert.jar, ons.jar, simplefan.jar, xdb.jar and xmlparserv2.jar
    • ojdbc11-production: will pull ojdbc11.jar, ucp.jar, oraclepki.jar, osdt_core.jar, osdt_cert.jar, ons.jar, simplefan.jar, xdb.jar and xmlparserv2.jar
    • Add the following dependency to your your project's pom.xml under the <dependencies> block (replace ojdbc8 with ojdbc11)
    • 
      
      <dependencies>
        <dependency>
          <groupId>com.oracle.database.jdbc</groupId>
          <artifactId>ojdbc11-production</artifactId>
          <version>23.4.0.24.05</version>
          <type>pom</type>
        </dependency>
      </dependencies>
      
      
      
      
      // For building with Gradle (build.gradle)
      dependencies {
         // Get 23.4.0.24.05 Oracle JDBC driver (ojdbc8.jar) and other companion jars
         implementation("com.oracle.database.jdbc:ojdbc11-production:23.4.0.24.05")
      }
      
      
  • Use Case 2: I Want the Production Jars with Debug instrumentation

    These jars have been compiled with the debugging option and not destined for production use. Depending on the JDBC Spec and JDK (Pre-requisites), you have the choice between ojdbc8-debug and ojdbc11-debug. Note that this is not needed for 23ai release.

    • ojdbc8-debug: will pull ojdbc8_g.jar, ucp.jar, oraclepki.jar, osdt_core.jar, osdt_cert.jar, ons.jar, simplefan.jar, xdb.jar and xmlparserv2.jar
    • ojdbc11-debug: will pull ojdbc11_g.jar, ucp.jar, oraclepki.jar, osdt_core.jar, osdt_cert.jar, ons.jar, simplefan.jar, xdb.jar and xmlparserv2.jar
    • Add the following dependency to your your project's pom.xml under the <dependencies> block (replace ojdbc8 with ojdbc11).
    • 
      
      <dependencies>
        <dependency>
          <groupId>com.oracle.database.jdbc.debug</groupId>
          <artifactId>ojdbc8-debug</artifactId>
          <version>19.18.0.0</version>
          <type>pom</type>
        </dependency>
      </dependencies>
      
      
      
      
      // For building with Gradle (build.gradle)
      dependencies {
         // Get 19.18.0.0 Oracle JDBC driver with debug (ojdbc8_g.jar) and other companion jars
         implementation("com.oracle.database.jdbc.debug:ojdbc8-debug:19.18.0.0")
      }
      
      
  • Use Case 3: I Want the Observability Jars

    These jars have instrumentation to support Oracle's Dynamic Monitoring Service (DMS) with limited support for java.util.logging and for production use (development, test, deployment). Depending on the JDBC Spec and JDK (Pre-requisites), you have the choice between ojdbc8-observability and ojdbc11-observability. Note that this is not needed for 23ai release.

    • ojdbc8-observability: will pull ojdbc8dms.jar, dms.jar, ucp.jar, oraclepki.jar, osdt_core.jar, osdt_cert.jar, ons.jar, simplefan.jar, xdb.jar and xmlparserv2.jar
    • ojdbc11-observability: will pull ojdbc11dms.jar, dms.jar, ucp.jar, oraclepki.jar, osdt_core.jar, osdt_cert.jar, ons.jar, simplefan.jar, xdb.jar and xmlparserv2.jar
    • Add the following dependency to your your project's pom.xml under the <dependencies> block (replace ojdbc8 with ojdbc11).
    • 
      
      <dependencies>
        <dependency>
          <groupId>com.oracle.database.observability</groupId>
          <artifactId>ojdbc8-observability</artifactId>
          <version>19.18.0.0</version>
          <type>pom</type>
        </dependency>
      </dependencies>
      
      
      
      
      // For building with Gradle (build.gradle)
      dependencies {
         // Get 19.18.0.0 Oracle JDBC driver with DMS (ojdbc8dms.jar) and other companion jars
         implementation("com.oracle.database.observability:ojdbc8-observability:19.18.0.0")
      }
      
      
  • Use Case 4: I Want the Observability Jars with Debug Instrumentation

    These jars have been compiled with the debugging option and instrumented to support Oracle's Dynamic Monitoring Service (DMS) with limited support for java.util.logging (see the JDBC doc for more details). These jars are not destined for production use. Depending on the JDBC Spec and JDK (Use Case 1), you have the choice between ojdbc8-observability-debug and ojdbc11-observability-debug. Note that this is not needed for 23ai release.

    • ojdbc8-observability-debug: will pull ojdbc8dms_g.jar, dms.jar, ucp.jar, oraclepki.jar, osdt_core.jar, osdt_cert.jar, ons.jar, simplefan.jar, xdb.jar and xmlparserv2.jar
    • ojdbc11-observability-debug: will pull ojdbc11dms_g.jar, dms.jar, ucp.jar, oraclepki.jar, osdt_core.jar, osdt_cert.jar, ons.jar, simplefan.jar, xdb.jar and xmlparserv2.jar
    • Add the following dependency to your your project's pom.xml under the <dependencies> block (replace ojdbc8 with ojdbc11).
    • 
      
      <dependencies>
        <dependency>
          <groupId>com.oracle.database.jdbc.debug</groupId>
          <artifactId>ojdbc8-observability-debug</artifactId>
          <version>19.18.0.0</version>
          <type>pom</type>
         </dependency>
      </dependencies>
      
      
      
      
      // For building with Gradle (build.gradle)
      dependencies {
         // Get 19.18.0.0 Oracle JDBC driver with DMS and debug (ojdbc8dms_g.jar) and other companion jars
         implementation("com.oracle.database.jdbc.debug:ojdbc8-observability-debug:19.18.0.0")
      }
      
      

DIY Using the BOM file

We furnish a BOM file which defines the list of artifacts available in the release, leaving to the Java developers the liberty to pick and choose the ones they want. However, figuring out which artifacts go together for specific use cases can be overwhelming, hence a set of copy/paste dependencies recipes based on use cases. Refer to "List of Artifacts (BOM)" for a summary description of each artifact.

Pre-requisites

The developer POM.xml file requires:
(1) <dependencyManagement> block helps in resolving versions of matching direct and transitive dependencies; the keys used to find an entry in the BOM are the groupId and the artifactId. This block is same for all use cases shown next.
(2) <dependencies> block to state which dependencies from the BOM it’ll consume; See the example for using ojdbc8.jar using the BOM approach. See the use cases section for the details.


<dependencyManagement>|
  <dependencies>
    <dependency>
      <groupId>com.oracle.database.jdbc</groupId>
       <artifactId>ojdbc-bom</artifactId>
       <version>23.4.0.24.05</version>
       <type>pom</type>
       <scope>import</scope>
     </dependency>
  </dependencies>
</dependencyManagement>
<dependencies>
  <dependency>
    <groupId>com.oracle.database.jdbc</groupId>
    <artifactId>ojdbc8</artifactId>
   </dependency>
 </dependencies>

DIY Use Cases

The goal of this document is to furnish ready to copy-and-paste recipes for managing the artifact dependencies for typical use cases.
    Here is the list.
  • Use Case 1: I want the Oracle JDBC driver
    Get either the ojdbc8.jar (supports JDBC 4.2) for use with JDK8 and JDK11 or the ojdbc11.jar (supports JDBC 4.3) for use with JDK11, JDK17, JDK19, and JDK21
    In your pom.xml file: a) Provision a 'dependencyManagement' block (copy from the pre-requisites section above) b) Provision the following 'dependencies' block for pulling ojdbc11 (or ojdbc8) artifact.
    
    
    <dependencies>
         <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc11</artifactId>
        </dependency>
    </dependencies>
    
    
    
    
    // For building with Gradle (build.gradle)
    dependencies {
       // Get BOM file and choose Oracle JDBC driver (ojdbc11.jar)
      implementation(enforcedPlatform("com.oracle.database.jdbc:ojdbc-bom:23.4.0.24.05"))
      implementation("com.oracle.database.jdbc:ojdbc11")
    }
    
    
  • Use Case 2: I Want the JDBC driver and the Java Connection Pool
    Get the JDBC driver using ojdbc8 or ojdbc11 AND ucp artifacts.
    In your pom.xml file: a) Provision a 'dependencyManagement' block (copy from the prerequisites section above) b) Provision a 'dependencies' block for pulling ojdbc11.jar (or ojdbc8.jar) and ucp.jar
    
    
      <dependencies>
           <dependency>
               <groupId>com.oracle.database.jdbc</groupId>
               <artifactId>ojdbc11</artifactId>
           </dependency>
    
          <dependency>
              <groupId>com.oracle.database.jdbc</groupId>
              <artifactId>ucp</artifactId>
           </dependency>
      </dependencies>
    
    
    
    
    // For building with Gradle (build.gradle)
    dependencies {
       // Get BOM file and choose Oracle JDBC driver (ojdbc11.jar) and Universal Connection Pool (ucp.jar)
      implementation(enforcedPlatform("com.oracle.database.jdbc:ojdbc-bom:23.4.0.24.05"))
      implementation("com.oracle.database.jdbc:ojdbc11")
      implementation("com.oracle.database.jdbc:ucp")
    }
    
    
  • Use Case 3: I Want to Connect to the Autonomous Database (ATP or ADW) Cloud Services
    The Oracle Autonomous Databases include the Autonomous Transaction Processing - Shared infrastructure (ATP-S), the Autonomous Transaction Processing - Dedicated infrastructure (ATP-D), and the Autonomous DataWarehouse (ADW). You have the choice of connecting to any of these Cloud services using either Oracle Wallet or Java KeyStore (JKS) as described in this Web page . However, connecting to ATP-D is only possible from a Cloud Compute instance as explained in this blog post.
    In your pom.xml file: a) Provision a 'dependencyManagement' block (copy from the prerequisite section above) b) Provision the following 'dependencies' block
    
    
    <dependencies>
          <dependency>
               <groupId>com.oracle.database.jdbc</groupId>
               <artifactId>ojdbc11</artifactId>
           </dependency>
          <dependency>
              <groupId>com.oracle.database.jdbc</groupId>
              <artifactId>ucp</artifactId>
           </dependency>
    
     <dependency>
            <groupId>com.oracle.database.security</groupId>
            <artifactId>oraclepki</artifactId>
     </dependency> 
    
     <dependency>
            <groupId>com.oracle.database.security</groupId>
            <artifactId>osdt_core</artifactId>
        </dependency>
    
       <dependency>
            <groupId>com.oracle.database.security</groupId>
            <artifactId>osdt_cert</artifactId>
        </dependency>
    
    
       <dependency>
            <groupId>com.oracle.database.ha</groupId>
            <artifactId>ons</artifactId>
        </dependency>
       <dependency>
            <groupId>com.oracle.database.security</groupId>
            <artifactId>oraclepki</artifactId>
        </dependency>
    
          
      <dependency>
            <groupId>com.oracle.database.ha</groupId>
            <artifactId>simplefan</artifactId>
      </dependency>
    </dependencies>
    
    
    
    
    // For building with Gradle (build.gradle)
    dependencies {
       // Get BOM file and choose Oracle JDBC driver (ojdbc11.jar) and Universal Connection Pool (ucp.jar)
      implementation(enforcedPlatform("com.oracle.database.jdbc:ojdbc-bom:23.4.0.24.05"))
      implementation("com.oracle.database.jdbc:ojdbc11")
      implementation("com.oracle.database.jdbc:ucp")
      // Additional Jars for using Oracle Wallets 
      implementation("com.oracle.database.security:oraclepki")
      implementation("com.oracle.database.security:osdt_core")
      implementation("com.oracle.database.security:osdt_cert")
      // Additional Jars for High Availability 
      implementation("com.oracle.database.ha:ons")
      implementation("com.oracle.database.ha:simplefan")
    }
    
    
  • Use Case 4: I Want High Availability Support
    There are built-in mechanisms in Oracle driver and pools enabling Java applications to sustain planned/unplanned database outages. The High availability mechanisms in the JDBC driver, the Java connection pool and required jars are described in details in the JDBC Developers Guide, the Java Connection Pool Developers Guide and in the Java Programming with Oracle database 19c white paper (Zero Downtime section).
    In your pom.xml file: (a) Provision a 'dependencyManagement' block (copy from the prerequisite section above) (b) Provision a 'dependencies' block as follows In summary: you need the JDBC driver artifact (ojdbc8 or ojdbc11), the recommended but not mandatory connection pool (ucp) artifact, the ons artifact, and if you are not using Oracle's Java connection pool (UCP or Active Gridlink) then, the simplefan artifact.
    
    
    <dependencies>
      <dependency>
        <groupId>com.oracle.database.jdbc</groupId>
        <artifactId>ojdbc11</artifactId>
       </dependency>
       <dependency>
         <groupId>com.oracle.database.jdbc</groupId>
         <artifactId>ucp</artifactId>
        </dependency>
        <dependency>
          <groupId>com.oracle.database.ha</groupId>
           <artifactId>ons</artifactId>
        </dependency>
        <dependency>
          <groupId>com.oracle.database.ha</groupId>
          <artifactId>simplefan</artifactId>
        </dependency>
    </dependencies>
    
    
    
    
    // For building with Gradle (build.gradle)
    dependencies {
       // Get BOM file and choose Oracle JDBC driver (ojdbc11.jar) and Universal Connection Pool (ucp.jar)
      implementation(enforcedPlatform("com.oracle.database.jdbc:ojdbc-bom:23.4.0.24.05"))
      implementation("com.oracle.database.jdbc:ojdbc8")
      implementation("com.oracle.database.jdbc:ucp")
      // Additional Jars for High Availability 
      implementation("com.oracle.database.ha:ons")
      implementation("com.oracle.database.ha:simplefan")
    }
    
    
  • Use Case 5: I want to support XML Data Types Using java.sql.SQLXML
    You need to get the JDBC driver, optionally the Java connection pool (ucp) then the xdb and xmlparserv2 artifacts.
    In your pom.xml file: (a) Provision a 'dependencyManagement' block (copy from the prerequisites section above) (b) Provision a 'dependencies' block for pulling the ojdbc8 (or ojdbc11), optionally ucp, xdb and xmlparserv2 artifacts.
    
    
    <dependencies>
      <dependency>
        <groupId>com.oracle.database.jdbc</groupId>
        <artifactId>ojdbc11</artifactId>
       </dependency>
       <dependency>
         <groupId>com.oracle.database.jdbc</groupId>
         <artifactId>ucp</artifactId>
        </dependency>
        <dependency>
          <groupId>com.oracle.database.xml</groupId>
          <artifactId>xdb</artifactId>
        </dependency>
        <dependency>
          <groupId>com.oracle.database.xml</groupId>
          <artifactId>xmlparserv2</artifactId>
        </dependency>
    </dependencies>
    
    
    
    
    // For building with Gradle (build.gradle)
    dependencies {
       // Get BOM file and choose Oracle JDBC driver (ojdbc11.jar) and Universal Connection Pool (ucp.jar)
      implementation(enforcedPlatform("com.oracle.database.jdbc:ojdbc-bom:23.4.0.24.05"))
      implementation("com.oracle.database.jdbc:ojdbc11")
      implementation("com.oracle.database.jdbc:ucp")
      // Additional Jars to support XML datatype 
      implementation("com.oracle.database.xml:xmlparserv2")
      implementation("com.oracle.database.xml:xdb")
    }
    
    
  • Use Case 6: I Want Internationalization (NLS) Support
    The orai18n artifact furnishes the Java classes for Internationalization support.
    In your pom.xml file: (a) Provision a 'dependencyManagement' block (copy from the prerequisites section above) (b) Provision a 'dependencies' block for pulling the ojdbc11 (or ojdbc8), optionally ucp and orai18n artifacts.
    
    
    <dependencies>
      <dependency>
        <groupId>com.oracle.database.jdbc</groupId>
         <artifactId>ojdbc11</artifactId>
       </dependency>
        <dependency>
          <groupId>com.oracle.database.jdbc</groupId>
          <artifactId>ucp</artifactId>
         </dependency>
         <dependency>
           <groupId>com.oracle.database.nls</groupId>
           <artifactId>orai18n</artifactId>
         </dependency>
      </dependencies>
    
    
    
    
    // For building with Gradle (build.gradle)
    dependencies {
       // Get BOM file and choose Oracle JDBC driver (ojdbc11.jar) and Universal Connection Pool (ucp.jar)
      implementation(enforcedPlatform("com.oracle.database.jdbc:ojdbc-bom:23.4.0.24.05"))
      implementation("com.oracle.database.jdbc:ojdbc11")
      implementation("com.oracle.database.jdbc:ucp")
      // Additional Jar to NLS support 
      implementation("com.oracle.database.nls:orai18n")
    }
    
    
  • Use Case 7: I Want the Observability jars
    Observability is provided through the Oracle Dynamic Monitoring Services (DMS) instrumentation with limited support for java.util.logging.
    In your pom.xml file: (a) Provision a 'dependencyManagement' block (copy from the prerequisites section above) (b) Provision a 'dependencies' block for pulling the ojdbc8 (or ojdbc11), dms, ojdbc8dms (or ojdbc11dms) artifacts and optionally ucp.
    
    
    <dependencies>  
        
        <dependency>
          <groupId>com.oracle.database.jdbc.observability</groupId>
          <artifactId>ojdbc8dms</artifactId> 
        </dependency>
     <dependency>
          <groupId>com.oracle.database.observability</groupId> 
          <artifactId>dms</artifactId> 
        </dependency>
    </dependencies>
    
    
    
    
    // For building with Gradle (build.gradle)
    dependencies {
       // Get BOM file and choose Oracle JDBC driver with DMS (ojdbc8dms.jar) 
      implementation(enforcedPlatform("com.oracle.database.jdbc:ojdbc-bom:19.18.0.0"))
      implementation("com.oracle.database.observability:ojdbc8dms")
      implementation("com.oracle.database.observability:dms")
    }
    
    
  • Use Case 8: I Want the Debug jars
    The Oracle JDBC driver jars have been optimized for production and do not have instrumentation to support debugging; you need to use the debug jars for debugging purpose. ojdbc8_g.jar and ojdbc11_g.jar will pull the production jars with debugging instrumentation whereas ojdbc8dms_g.jar and ojdbc11dms_g.jar will pull the observability jars with debugging instrumentation.
    In your pom.xml file: (a) Provision a 'dependencyManagement' block (copy from the prerequisites section above) (b) Provision a 'dependencies' block for pulling the ojdbc8_g (or ojdbc11_g), dms and ojdbc8dms_g (or ojdbc11_dms_g) artifacts
    
    
    <dependencies>
      <dependency>     
        <groupId>com.oracle.database.jdbc.debug</groupId>
        <artifactId>ojdbc8_g</artifactId>
       </dependency>     
        <dependency>
           <groupId>com.oracle.database.observability</groupId> 
           <artifactId>dms</artifactId> 
        </dependency>
        <dependency>
          <groupId>com.oracle.database.jdbc.debug</groupId>
           <artifactId>ojdbc8dms_g</artifactId> 
         </dependency>
    </dependencies>
    
    
    
    
    // For building with Gradle (build.gradle)
    dependencies {
       // Get BOM file and choose Oracle JDBC driver with debug (ojdbc8_g.jar) or (ojdbc8dms_g.jar) 
      implementation(enforcedPlatform("com.oracle.database.jdbc:ojdbc-bom:19.18.0.0"))
      implementation("com.oracle.database.jdbc.debug:ojdbc8_g") 
      implementation("com.oracle.database.jdbc.debug:ojdbc8dms_g")
      implementation("com.oracle.database.observability:dms")
    }
    
    
  • Use Case 9: I Just Want the Java Connection Pool
    This use case consists of using ucp.jar with non-Oracle JDBC for non-Oracle database. As of DB 19c, UCP has a compile time dependency on Oracle JDBC; this is being fixed as we speak and will materialize in the next release (DB21c and up).
    In your pom.xml file: (a) Provision a 'dependencyManagement' block (copy from the prerequisites section above) (b) Provision a 'dependencies' block for pulling the ucp and ojdbc11 (or ojdbc8) artifacts.
    
    
    <dependencies>
      <dependency>
        <groupId>com.oracle.database.jdbc</groupId>
        <artifactId>ucp</artifactId>
      </dependency>
    </dependencies>
    
    
    
    
    // For building with Gradle (build.gradle)
    dependencies {
       // Get BOM file and choose Universal Connection Pool (ucp.jar)
      implementation(enforcedPlatform("com.oracle.database.jdbc:ojdbc-bom:23.4.0.24.05"))
      implementation("com.oracle.database.jdbc:ucp") 
    }
    
    
  • Use Case 10: I Only Want the Security Artifacts
    These artifacts are required for Java connectivity to the Oracle database using Oracle Wallets.
    In your pom.xml file: (a) Provision a 'dependencyManagement' block (copy from the prerequisites section above) (b) Provision a 'dependencies' block for pulling the osdt_core, osdt_cert and oraclepki artifacts.
    
    
    <dependencies>
      <dependency>
         <groupId>com.oracle.database.security</groupId>
         <artifactId>osdt_core</artifactId>
      </dependency>
      <dependency>
        <groupId>com.oracle.database.security</groupId>
        <artifactId>osdt_cert</artifactId>
       </dependency>
      <dependency>
         <groupId>com.oracle.database.security</groupId>
         <artifactId>oraclepki</artifactId>
       </dependency>
    </dependencies>
    
    
    
    
    // For building with Gradle (build.gradle)
    dependencies {
       // Get BOM file and choose Oracle Security Artifacts (oraclepki.jar, osdt_core.jar, and osdt_cert.jar)
      implementation(enforcedPlatform("com.oracle.database.jdbc:ojdbc-bom:23.4.0.24.05"))
      implementation("com.oracle.database.security:oraclepki") 
      implementation("com.oracle.database.security:osdt_core")
      implementation("com.oracle.database.security:osdt_cert")
    }
    
    
  • Use Case 11: I Only Want the Simplefan Artifact
    The artifact, simplefan.jar supports the Java APIs for subscribing to Fast Application Notification (FAN) events; it is required when not using the Oracle Java connection pool (ucp, Weblogic ActiveGridLink). Please note that simplefan requires ons.jar for publishing events to subscribers. In your pom.xml file: a) Provision a 'dependencyManagement' block (copy from the prerequisites section above) b) Provision a 'dependencies' block for pulling the simplefan artifact.
    
    
    <dependencies>
      <dependency>
         <groupId>com.oracle.database.ha</groupId>
          <artifactId>simplefan</artifactId>
        </dependency>
    </dependencies>
    
    
    
    
    // For building with Gradle (build.gradle)
    dependencies {
       // Get BOM file and choose Simple Fan Library (simplefan.jar)
      implementation(enforcedPlatform("com.oracle.database.jdbc:ojdbc-bom:23.4.0.24.05"))
      implementation("com.oracle.database.ha:simplefan") 
    }
    
    
  • Use Case 12: Other Use Cases
  • Please let us know (@kmensah) about other use cases you would want to be documented.

Gradle Dependencies

Here is a sample on how to add Oracle JDBC driver as a dependency in your gradle project.

  • Prerequisites: Make sure to have Maven as a repository in your build.gradle file.
    
                      
    repositories {
       // Maven Central repository
       mavenCentral()
    }
                    
                   
  • Individual Files: If you want to download only Oracle JDBC driver or other companion files individually then add the dependency for that particular artifact. The snippet below shows adding Oracle JDBC driver but, look for the groupId and artifactId for the other artifacts that you want to download from the "List of Artifacts (BOM)" section
  • 
                      
    dependencies {
       // Get the 23.4.0.24.05 Oracle JDBC driver 
        implementation("com.oracle.database.jdbc:ojdbc11:23.4.0.24.05")
    }
                    
                   
  • Pre-established Dependencies: If you want to download Oracle JDBC driver along with other companion jars such as ucp.jar, oraclepki.jar, osdt_core.jar, osdt_cert.jar etc., then use the following dependency. For other flavors (ojdbc8-debug, ojdbc8-observability, ojdbc8-observability-debug) refer to "Pre-established Use Cases" section
  • 
                      
    dependencies {
       // Get the 23.4.0.24.05 Oracle JDBC driver along with other companion jars
        implementation("com.oracle.database.jdbc:ojdbc11-production:23.4.0.24.05")
    }
                    
                   
  • Using BOM file: You can leverage a BOM (Bill of Materials) file and pick and choose the artifacts for a particular usecase. The code snippet below shows using a BOM for getting the Oracle JDBC driver along with the Universal Connection Pool (UCP). For other use cases, refer to "DIY using the BOM file" section
  • 
                      
    dependencies {
       // Get the 23.4.0.24.05 Oracle JDBC driver along with Universal Connection Pool using a BOM file
       implementation(enforcedPlatform("com.oracle.database.jdbc:ojdbc-bom:23.4.0.24.05"))
       implementation("com.oracle.database.jdbc:ojdbc11")
       implementation("com.oracle.database.jdbc:ucp")
    }