Maven需要下载解压并添加到classpath,如果不明可以参考https://www.cnblogs.com/xiandedanteng/p/11403480.html

然后在命令行窗口执行:

mvn install:install-file -Dfile=D:\jars\ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -DgeneratePom=true

上面粗体就是我本机上ojdbc6.jar的全路径名,大家要拿下去执行请务必记得修改。

执行效果如下:

C:\Users\horn1>mvn install:install-file -Dfile=D:\jars\ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -DgeneratePom=true
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom (3.9 kB at 467 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom (6.4 kB at 2.4 kB/s)
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM)
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.pom (2.5 kB at 1.5 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/3.1/plexus-3.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/3.1/plexus-3.1.pom (19 kB at 4.9 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.pom (1.1 kB at 1.5 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.1.7/plexus-components-1.1.7.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.1.7/plexus-components-1.1.7.pom (5.0 kB at 1.9 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom (7.2 kB at 1.3 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.pom (7.3 kB at 3.1 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar (12 kB at 10.0 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0.5/plexus-utils-3.0.5.jar (230 kB at 14 kB/s)
[INFO] Installing D:\jars\ojdbc6.jar to C:\Users\horn1\.m2\repository\com\oracle\ojdbc6\11.2.0.3\ojdbc6-11.2.0.3.jar
[INFO] Installing C:\Users\horn1\AppData\Local\Temp\mvninstall120007549088651343.pom to C:\Users\horn1\.m2\repository\com\oracle\ojdbc6\11.2.0.3\ojdbc6-11.2.0.3.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  48.504 s
[INFO] Finished at: --10T12::+:
[INFO] ------------------------------------------------------------------------

看到Build Success就表示成功了。如果是Build failed也不要着急,隔天说不定就好了。昨天我的机器上就加载不进去,今天就莫名其妙好了。

成功后本地maven库是这样的:

之后在pom.xml中这样配就行了。

<dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
        <version>11.2.0.3</version>
</dependency>

最后在Eclipse里验证一下:

如果这一步还不成功,那么按以前的办法加载外部jar包也行。

最后感谢以下两位小伙伴的网文:

https://www.cnblogs.com/zhuwenjoyce/p/10923547.html

https://blog.csdn.net/qq_38263715/article/details/80698499

--END-- 2019年11月10日12:57:52

【Oracle/Maven】Maven导入oracle11g 自携带jdbc驱动包ojdbc6.jar到本地库的更多相关文章

  1. Oracle 11g Java驱动包ojdbc6.jar安装到maven库,并查看jar具体版本号

    ojdbc6.jar下载 Oracle官方宣布的Oracle数据库11g的驱动jar包是ojdbc6.jar ojdbc6.jar下载地址:https://www.oracle.com/technet ...

  2. maven添加sqlserver的jdbc驱动包

    http://search.maven.org/中没有sqlserver的jdbc驱动,所以需要本地安装sqljdbc的jar包,然后再在pom里面引入 Step 1 在微软官网下载sqljdbc的j ...

  3. Oracle、DB2、MySql、SQLServer JDBC驱动

    四种数据库JDBC驱动,还列出了连接的Class驱动名和Url Pattern,DB2包括Type 2.Type 3和Type 4三种模式.注意驱动包名称的大小写. Oralce连接驱动包名和URL ...

  4. 各种数据库(oracle、mysql、sqlserver等)在Spring中数据源的配置和JDBC驱动包----转

    在开发基于数据库的应用系统时,需要在项目中进行数据源的配置来为数据 库的操作取得数据库连接.配置不同数据库的数据源的方法大体上都是相同的,不同的只是不同数据库的JDBC驱动类和连接URL以及相应的数据 ...

  5. IntelliJ IDEA载入JDBC驱动包

    1.下载zip格式的驱动包:https://dev.mysql.com/downloads/connector/j/ 2.解压zip,放到任意位置.其中的mysql-connector-java.ja ...

  6. MySQL5.5.33对应的JDBC驱动包怎样使用?

    双击msi文件就会自动安装,然后找到安装路径下的jar,并把它加到类路径下,如手动编译和执行时javac -classpath c:\program files\...\mysql.jar;... m ...

  7. maven加载本地oracle的JDBC驱动

    转载自:http://blog.csdn.net/qicyt1812/article/details/13019933 由于oracle商业版权问题,maven不能通过中心资源库直接下载jar包,如果 ...

  8. MapReduce 程序mysql JDBC驱动类找不到原因及学习hadoop写入数据到Mysql数据库的方法

    报错 :ClassNotFoundException: com.mysql.jdbc.Driver 需求描述: hadoop需要动态加载个三方jar包(比如mysql JDBC 驱动包),是在MR结束 ...

  9. 在Maven仓库中添加Oracle数据库的JDBC驱动依赖

    在使用idea连接oracle数据库时发现直接添加oracle依赖 <dependency><groupId>com.oracle</groupId><art ...

随机推荐

  1. Android面试题 描述一下android的系统架构

    android系统架构从下往上为linux内核层.运行库.应用程序框架层和应用程序层. Linux Kernel:负责硬件的驱动程序.网络.电源.系统安全以及内存管理等功能. Libraries和an ...

  2. c# VS.NET 中的调试工具

  3. RestFramework之注册器、响应器与分页器

    一.注册器的说明与使用 在我们编写url时经常会因请求方式不同,而重复编写某条url,而rest_framework中的注册器帮我节省了很多代码 下面介绍一下如何使用 # 利用注册器来实现路由分发 f ...

  4. [Python]pip install offline 如何离线pip安装包

    痛点:目标机器无法连接公网,但是能使用rz.sz传输文件 思路:在能上网的机器是使用pip下载相关依赖包,然后传输至目标机器,进行安装 0. Install pip: http://pip-cn.re ...

  5. Linux下常用mysql命令【2】

    1.开启和关闭 1.1.开启 systemctl start mysqld 1.2.关闭 systemctl stop mysqld 1.3.重启 systemctl restart mysqld 回 ...

  6. subprocess、struct模块的简单应用与ssh模型(黏包)

    一.subprocess模块 #可以通过传递字符串命令,帮你去实现一些操作系统的命令. import subprocess res = subprocess.Popen("dir" ...

  7. RollingRegression(滚动回归分析)之Python实现

    # -*- coding: utf-8 -*-"""Created on Sat Aug 18 11:08:38 2018 @author: acadsoc"& ...

  8. 大数据之路week06--day07(虚拟机的克隆)

    1.安装vmware,务必以管理员身份运行 操作系统(CentOS 6.5)的配置 准备工作:虚拟机安装三台linux  本次测试是 centos 6.5,(三台虚拟机的系统时间保持一致) *安装jd ...

  9. Codeforces Round #609 (Div. 2) D. Domino for Young

    链接: https://codeforces.com/contest/1269/problem/D 题意: You are given a Young diagram. Given diagram i ...

  10. fsLayuiPlugin入门使用

    简介 源码下载后,不能直接打开,必须运行在容器下,例如:nginx.tomcat.jetty等容器. 源码中默认配置了nginx容器,可以直接启动nginx访问. 本文主要介绍下载源码后的使用,避免在 ...