I just learned spring boot. Because the company uses Oracle and Oracle’s ojdbc.jar is charged, there is no such resource in Maven’s central warehouse. Only by configuring the local library can it be loaded into the project
First configure the local Maven warehouse address:
2. Find Oracle jar package
The jar package in my computer is placed at:
D:\app\admin\product\11.2.0\dbhome_ 1\jdbc\lib
Open the directory where the jar package is located: then hold down shift and right-click to open the command line, execute the following command to add ojdbc6.jar package to maven, that is to say, run the following statement. Note: it is not run under C disk, but under this directory
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.1.0 -Dpackaging=jar -Dfile=ojdbc6.jar
The command line is as follows:
D:\app\admin\product\11.2.0\dbhome_1\jdbc\lib>mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.1.0 -Dpackaging=jar -Dfile=ojdbc6.jar [INFO] Scanning for projects... Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom (3.9 kB at 12 kB/s) Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-plugins/22/maven-plugins-22.pom Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-plugins/22/maven-plugins-22.pom (13 kB at 85 kB/s) Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar (25 kB at 138 kB/s) Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom (6.4 kB at 37 kB/s) Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.jar Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.jar (27 kB at 125 kB/s) [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Stub Project (No POM) 1 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom --- Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.pom Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.pom (2.5 kB at 15 kB/s) Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus/3.1/plexus-3.1.pom Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus/3.1/plexus-3.1.pom (19 kB at 118 kB/s) Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.pom Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.pom (1.1 kB at 5.4 kB/s) Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-components/1.1.7/plexus-components-1.1.7.pom Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-components/1.1.7/plexus-components-1.1.7.pom (5.0 kB at 32 kB/s) Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom (7.2 kB at 50 kB/s) Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.pom Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.pom (7.3 kB at 46 kB/s) Downloading: http://maven.aliyun.com/nexus/content/groups/public/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar (12 kB at 66 kB/s) Downloaded: http://maven.aliyun.com/nexus/content/groups/public/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar (38 kB at 189 kB/s) Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar (230 kB at 462 kB/s) [INFO] Installing D:\app\admin\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6.jar to E:\eclipse\spring-tool-suite-3.9.0.RELEASE-e4.7.0-win32-x86_64\sts-bundle\sts-3.9.0.RELEASE\repository\com\oracle\ojdbc6\11.2.0.1.0\ojdbc6-11.2.0.1.0.jar [INFO] Installing C:\Users\admin\AppData\Local\Temp\mvninstall887833532666323655.pom to E:\eclipse\spring-tool-suite-3.9.0.RELEASE-e4.7.0-win32-x86_64\sts-bundle\sts-3.9.0.RELEASE\repository\com\oracle\ojdbc6\11.2.0.1.0\ojdbc6-11.2.0.1.0.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.636 s [INFO] Finished at: 2018-01-02T21:31:04+08:00 [INFO] Final Memory: 10M/362M [INFO] ------------------------------------------------------------------------
Finally, find the pom.xml of the project, introduce the following code, right-click the project name, find maven, find update project, and update it
<!-- oracle database driver -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.1.0</version>
</dependency>