Home > Java > javaTutorial > How Can I Add the Oracle JDBC Driver (ojdbc14) to My Maven Project?

How Can I Add the Oracle JDBC Driver (ojdbc14) to My Maven Project?

Linda Hamilton
Release: 2024-12-10 16:16:11
Original
695 people have browsed it

How Can I Add the Oracle JDBC Driver (ojdbc14) to My Maven Project?

Maven Repository for Oracle JDBC Driver (ojdbc14)

In Maven, finding a repository for dependencies can be crucial, especially for libraries like the Oracle JDBC driver. While the MVNrepository website suggests a dependency for ojdbc14, it's essential to know that this driver is not available in the central Maven repository due to licensing restrictions.

Adding an External Repository

Since the driver is not available in the central repository, we need to add an external repository to Maven that contains the ojdbc14 artifact. Unfortunately, no public repository can legally host the Oracle JDBC driver due to its binary license.

Using a POM Entry

Despite the absence of a public repository, Maven provides a way to handle such dependencies through a POM entry in the Maven Central repository. This entry contains the preferred Maven information and a URL to download the JAR file.

Installing the JAR Locally

To utilize the Oracle JDBC driver, you need to download the JAR file from the URL provided in the POM entry and install it in your local Maven repository using the following command:

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 \
-Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=ojdbc.jar -DgeneratePom=true
Copy after login

This command will add the JAR to your local repository and generate a POM for it. Adding the -DgeneratePom=true parameter prevents warnings in your pom.xml file.

Sharing in a Local Repository

If your team maintains a local Maven repository, you can upload the JAR there for sharing and convenient access. Refer to specific guidelines for your local repository setup.

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

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template