DEV Community

NDONGO TONUX SAMB
NDONGO TONUX SAMB

Posted on • Updated on

How to add an Oracle JDBC driver to your maven repository

We are going to see how to add an Oracle JDBC driver in your local Maven repository and how to reference it in your pom.xml.

Download the Oracle JDBC driver

link : https://www.oracle.com/database/technologies/jdbcdriver-ucp-downloads.html

You have to go to the Oracle site to get the Oracle JDBC driver. Choose the right version of the jar. Example ojdbc6.jar or ojdbc7.jar

Settling in Maven

To install the Oracle jdbc drivers you have to go to the terminal and put the following command:

mvn install:install-file -Dfile={Path/to/your/ojdbc6.jar}
  -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar
Enter fullscreen mode Exit fullscreen mode

Setting the pom.xml

In your pom add now the dependency :

<dependencies>        ...
    <!-- ojdbc6.jar example -->
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
        <version>11.2.0</version>
    </dependency>

    ...

</dependencies>
Enter fullscreen mode Exit fullscreen mode

NB : Note that for the jar ojdbc7.jar the version in the pom becomes
12.1.0

Takk Jokk

Top comments (0)