Manually add the Oracle JDBC driver to the MAVEN local warehouse

Source: Internet
Author: User

One, when we need to connect to a database in a MAVEN project, we only need to configure its dependencies, but Maven does not provide Oracle JDBC driver, which is not available due to Oracle licensing issues and needs to be added manually.

Second, get the jar package that connects to the database, here is Oracle, for example,

1, the OJDBC jar package will be generated automatically when the version above oracle10g is installed. Can be used directly,

2, if not, you need to download one from the official website, http://www.oracle.com/technetwork/database/features/jdbc/default-2280470.html

3, copied directly from the Oracle installation package, on my own computer, Oracle is installed on the D drive, copy Ojdbc6.jar to the root of the F drive, "D:\app\Administrator\product\11.2.0\dbhome_1 \jdbc\lib\ojdbc6.jar "Copy to" F:\ "

and execute the MAVEN command

C:\users\administrator>mvn install:install-file - Dgroupid=com.oracle - Dartifactid=ojdbc6 -dversion=< Span class= "Hljs-number" >10.2.0.2 .0 -dpackaging=jar -Dfile< Span class= "Hljs-subst" >=f:/ojdbc6.jar

Then, when you open the local Maven repository, you will find that the OJDBC jar package has been added successfully.

4, add dependencies in the Pom file, and note that the version number in the dependency is consistent with the MAVEN command performed above.

<!--oracle-->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.2.0</version>
</dependency>

Manually add the Oracle JDBC driver to the MAVEN local warehouse

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.