Because of Oracle licensing issues, MAVEN does not provide Oracle JDBC driver, which must be manually added to the local warehouse in order to apply the Oracle JDBC driver in the MAVEN project.
First, you need to download the OJDBC jar package to the Oracle official website.
Http://www.oracle.com/technetwork/database/features/jdbc/default-2280470.html
I chose Ojdbc7.jar, the corresponding version is 12.1.0.2.
Ojdbc7.jar (3,698,857 bytes)-(SHA1 checksum:7c9b5984b2c1e32e7c8cf3331df77f31e89e24c2)
For use with JDK 7; It contains the JDBC driver classes except classes for NLS support in Oracle Object and Collection types.
Note that Ojdbc7.jar is used on JDK 7, but it seems that Ojdbc6.jar can also be used on JDK 7.
I then save the downloaded Ojdbc7.jar in the ~/additional_jars/directory.
Run:
MVN install:install-file-dgroupid=com.oracle-dartifactid=ojdbc7-dversion=12.1.0.2-dpackaging=jar-dfile=~/ Additional_jars/ojdbc7.jar
Then an error occurs, so I CD to the ~/additional_jars/directory and then run:
MVN install:install-file-dgroupid=com.oracle-dartifactid=ojdbc7-dversion=12.1.0.2-dpackaging=jar-dfile= Ojdbc7.jar
Then it's still a mistake.
Later I found the cause of the error because I was under windows and I ran this section of the program on the GIT command line that was opened.
Open the Windows command-line interface, enter the ~/additional_jars/directory, and then run:
MVN install:install-file-dgroupid=com.oracle-dartifactid=ojdbc7-dversion=12.1.0.2-dpackaging=jar-dfile= Ojdbc7.jar
Show "BUILD SUCCESS".
You can then add dependency to the MAVEN project, and the coordinates correspond to the elements of the command above, as follows:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
Maven Add dependency manually (Oracle JDBC as an example)