---
title: "Maven仓库添加Oracle JDBC驱动"
author: "longfor5"
date: "2014-12-07T20:35:10Z"
tags: []
categories: ["开源软件"]
slug: "maven-oracle-jdbc"
draft: false
lastmod: "2014-12-07T20:35:10Z"
id: 2163994
url: "https://longfor5.iteye.com/blog/2163994"
---

由于Oracle授权问题，Maven3不提供Oracle JDBC driver，为了在Maven项目中应用Oracle JDBC driver,必须手动添加到本地仓库。

**一.获得Oracle JDBC Driver**

1.通过Oracle官方网站下载相应版本：[http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html](http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html)

2.通过Oracle的安装目录获得，位置在“{ORACLE\_HOME}\\jdbc\\lib\\ojdbc14.jar”

 

**二.手动安装安装**

手动安装请参考另一篇文章：***[maven3 手动安装本地jar到仓库](http://www.cnblogs.com/leiOOlei/p/3356834.html)***

 

或者命令如下：

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

 

**三.pom.xml文件中添加引用**

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

 

参考原文：http://www.cnblogs.com/leiOOlei/p/3380568.html