How to add Oracle JDBC driver into Maven (ojdbc8.jar and ojdbc7.jar)

This tutorial shows you how to add Oracle JDBC driver into Maven local repository and also how to reference it in pom.xml. Due to Oracle license restrictions, the Oracle JDBC driver is not available in the public Maven repository. To use the Oracle JDBC driver with Maven, we have to download and install it manually into Maven local repository

Let’s begin:

Get Oracle JDBC Driver
Depends your need, you can download Oracle JDBC Driver that you want to use for your oracle version. For example, Oracle Database 12.2.0.1 works with Oracle JDBC Driver named ojdbc8.jar. Oracle Database 12.1.0.2 works with ojdbc7.jar.

Visit Oracle website to get the Oracle JDBC driver – ojdbc8.jar or ojdbc7.jar

how to add Oracle JDBC driver into Maven (ojdbc8.jar and ojdbc7.jar)

Maven install
To install the Oracle jdbc drivers, go to the console:

Run the below command to install ojdbc8.jar

Run the below command to install ojdbc7.jar

See the result when we try to install ojdbc7.jar in maven local repository. Run the maven command line, the output will show like below

You can do the same with ojdbc8.jar

Configure Oracle JDBC driver dependency
If you want to use ojdbc8.jar dependency, add this to the pom.xml

If you want to use ojdbc7.jar dependency, add this to the pom.xml

Ok done, now you can use Oracle JDBC driver dependency same as other dependencies.

That’s all on the tutorial How to add Oracle JDBC driver into Maven local repository

References
Oracle Database JDBC Driver

Leave a Comment

*

Please share it if you found this useful
Hide Buttons