Home >Java >javaTutorial >How to Add the Oracle JDBC Driver to Your Maven Project?

How to Add the Oracle JDBC Driver to Your Maven Project?

Barbara Streisand
Barbara StreisandOriginal
2025-01-01 00:46:09595browse

How to Add the Oracle JDBC Driver to Your Maven Project?

Find Oracle JDBC Driver in Maven Repository

The Oracle JDBC driver (ojdbc14) is not available in the central Maven repository due to licensing restrictions. Therefore, you need to find an alternative repository to add it as a dependency in your project.

Finding Alternative Repository

Unfortunately, there are no public repositories that legally distribute the Oracle JDBC driver. Any repositories claiming to host the driver are likely violating Oracle's copyright.

Adding Alternate Repository

Since the driver is not available in public repositories, you must manually download it from the Oracle website. Once downloaded, follow these steps to add it to your Maven project:

  1. Place the ojdbc14.jar file in your local Maven repository:
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 \
-Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=ojdbc.jar -DgeneratePom=true
  1. Add the dependency to your Maven POM file:
<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc14</artifactId>
    <version>10.2.0.3.0</version>
    <scope>runtime</scope>
</dependency>

Note that you may need to adjust the version number depending on the version of the Oracle driver you downloaded.

The above is the detailed content of How to Add the Oracle JDBC Driver to Your Maven Project?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn