Add Oracle JDBC driver to Maven repository

Due to the Oracle authorization problem, Maven3 does not provide the Oracle JDBC driver. In order to apply the Oracle JDBC driver in the Maven project, it must be manually added to the local repository.

1. First get the Oracle JDBC Driver

Download from the official website: http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html

After the download is complete, use the maven command to install it into your local repository, open cmd and
type the following command

mvn install:install-file -Dfile={Path/to/your/ojdbc.jar} -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

Note: -Dfile={Path/to/your/ojdbc.jar} is the path where the jar is located, so put the jar package in your path in advance, the specific path is up to you. Like me, just -Dfile=ojdbc6 .jar, so it's under C:\Users\xxx 

After build succeeded, you can import the pom file

<dependencies>
    <!-- 添加oracle jdbc driver -->  
    <dependency>    
        <groupId>com.oracle</groupId>    
        <artifactId>ojdbc14</artifactId>    
        <version>10.2.0.4.0</version>
    </dependency>
  </dependencies>

That's fine

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325454849&siteId=291194637