Home > Java > javaTutorial > How to Add Oracle JDBC Driver to Maven Project Without a Public Repository?

How to Add Oracle JDBC Driver to Maven Project Without a Public Repository?

Patricia Arquette
Release: 2024-12-11 11:07:10
Original
653 people have browsed it

How to Add Oracle JDBC Driver to Maven Project Without a Public Repository?

How to Add Oracle JDBC Driver to Maven Project Without Public Repository

In theory, to add the Oracle JDBC driver to your Maven project, you could include the following dependency in your POM:

<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc14</artifactId>
    <version>10.2.0.3.0</version>
</dependency>
Copy after login

However, this will fail because the driver JAR isn't available in the central Maven repository due to licensing restrictions.

Locating a Repository with Oracle JDBC Driver

Unfortunately, no public repository contains the Oracle JDBC driver, as its binary license prohibits public distribution.

Adding Oracle JDBC Driver Without Repository

Since a public repository isn't available, you'll need to manually download the driver JAR from Oracle's website:

  1. Visit the following URL: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
  2. Download the desired Oracle JDBC driver version.

Installing Driver JAR in Local Repository

Once you have the JAR, you can 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

Leveraging Oracle's Maven Info

While there's no public repository, Oracle provides a POM entry in the Maven Central repo with the necessary information:

<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.3.0</version>
Copy after login

This allows you to include the Oracle JDBC driver as a dependency without specifying the repository. Maven will automatically download the JAR from Oracle's website when needed.

The above is the detailed content of How to Add Oracle JDBC Driver to Maven Project Without a Public Repository?. 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