Managing Oracle Driver packages with MAVEN

Source: Internet
Author: User
Tags lenovo

Due to Oracle licensing issues, MAVEN3 does not provide Oracle JDBC driver and must be manually added to the local warehouse in order to apply the Oracle JDBC driver in the MAVEN project.

Manually added to the local warehouse requires the local Oracle driver package, there are two ways to obtain the Oracle driver package: One is to download the Oracle website, and if the corresponding version of Oracle installed locally, can be found in the installation file.

First, download the Oracle driver package

1.oracle official website Download:

If you do not have an Oracle database installed locally, you can download it from the Oracle official network:

: http://www.oracle.com/technetwork/indexes/downloads/index.html

2. Get from the locally installed Oracle directory

If you have an Oracle database installed locally, you can select Ojdbc6.jar from the installation path: E:\app\product\11.2.0\dbhome_1\jdbc\lib (my path).

If you do not know the local Oracle version can be passed: SELECT * from v$version; the results are as follows:

  

Second, load into the local MAVEN library

MVN install:install-file-dgroupid=com.oracle-dartifactid=ojdbc14-dversion=10.2.0.5.0-dpackaging=jar-dfile= Local path \ Ojdbc12.jar

MVN Install:install-file-dgroupid=com.oracle-dartifactid=ojdbc6-dversion=11.2.0.1.0-dpackaging=jar-dfile=d: \app\lenovo\product\11.1.0\db_1\jdbc\lib\ojdbc6.jar

In particular, note that DartifactId and dversion are consistent with the version of the jar used

Copy the command to the cmd command prompt for execution:

  

The prerequisite is that the MAVEN environment variable is configured, and if no configuration needs to be entered into the Maven bin directory first.

Execution Result:

  

Indicates success.

Iii. after installation, add references in the Pom.xml file

Example of 1.oralce 10g

<Dependencies>    <!--Add Oracle JDBC Driver -      <Dependency>            <groupId>Com.oracle</groupId>            <Artifactid>Ojdbc14</Artifactid>            <version>10.2.0.4.0</version>    </Dependency> </Dependencies>

Example of 2.oracle 11g

<Dependency>    <groupId>Com.oracle</groupId>    <Artifactid>Ojdbc6</Artifactid>    <version>11.2.0.1.0</version></Dependency>

It is important to note that the groupid,artifactid,version in the XML file above must be used with the "MVN INSTALL:INSTALL-FILE-DGROUPID=COM.ORACLE-DARTIFACTID=OJDBC6 -dversion=11.2.0.1.0-dpackaging=jar-dfile=d:\app\lenovo\product\11.1.0\db_1\jdbc\lib\ojdbc6.jar "in the same.

  

Reference article: 1.http://www.cnblogs.com/leioolei/archive/2013/10/21/3380568.html

2.http://m.blog.csdn.net/blog/jinsique/38312375

3.http://blog.csdn.net/cnham/article/details/5388016

  

Managing Oracle Driver packages with MAVEN

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.