loading...

How to add an Oracle JDBC driver to your maven repository

tonux_samb profile image NDONGO SAMB ・1 min read

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

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

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>

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

Takk Jokk

Posted on by:

tonux_samb profile

NDONGO SAMB

@tonux_samb

Software Engineer, working with high availability web

Discussion

markdown guide