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