java - Find Oracle JDBC driver in Maven repository

ID : 10118

viewed : 62

Tags : javamavenjdbcmaven-2mvn-repojava

Top 5 Answer for java - Find Oracle JDBC driver in Maven repository

vote vote


How do I find a repository (if any) that contains this artifact?

Unfortunately due the binary license there is no public repository with the Oracle Driver JAR. This happens with many dependencies but is not Maven's fault. If you happen to find a public repository containing the JAR you can be sure that is illegal.

How do I add it so that Maven will use it?

Some JARs that can't be added due to license reasons have a pom entry in the Maven Central repo. Just check it out, it contains the vendor's preferred Maven info:

<groupId></groupId> <artifactId>ojdbc14</artifactId> <version></version> 

...and the URL to download the file which in this case is

Once you've downloaded the JAR just add it to your computer repository with (note I pulled the groupId, artifactId and version from the POM):

mvn install:install-file -DartifactId=ojdbc14 \      -Dversion= -Dpackaging=jar -Dfile=ojdbc.jar -DgeneratePom=true 

The last parameter for generating a POM will save you from pom.xml warnings

If your team has a local Maven repository this guide might be helpful to upload the JAR there.

vote vote


For whatever reason, I could not get any of the above solutions to work. (Still can't.)

What I did instead was to include the jar in my project (blech) and then create a "system" dependency for it that indicates the path to the jar. It's probably not the RIGHT way to do it, but it does work. And it eliminates the need for the other developers on the team (or the guy setting up the build server) to put the jar in their local repositories.

UPDATE: This solution works for me when I run Hibernate Tools. It does NOT appear to work for building the WAR file, however. It doesn't include the ojdbc6.jar file in the target WAR file.

1) Create a directory called "lib" in the root of your project.

2) Copy the ojdbc6.jar file there (whatever the jar is called.)

3) Create a dependency that looks something like this:

<dependency>     <groupId></groupId>     <artifactId>ojdbc</artifactId>     <version>14</version>     <scope>system</scope>     <systemPath>${basedir}/lib/ojdbc6.jar</systemPath> <!-- must match file name --> </dependency> 

Ugly, but works for me.

To include the files in the war file add the following to your pom

<build>     <finalName>MyAppName</finalName>     <plugins>         <plugin>             <groupId>org.apache.maven.plugins</groupId>             <artifactId>maven-war-plugin</artifactId>             <configuration>                 <webResources>                     <resource>                         <directory>${basedir}/src/main/java</directory>                         <targetPath>WEB-INF/classes</targetPath>                         <includes>                             <include>**/*.properties</include>                             <include>**/*.xml</include>                             <include>**/*.css</include>                             <include>**/*.html</include>                         </includes>                     </resource>                     <resource>                         <directory>${basedir}/lib</directory>                         <targetPath>WEB-INF/lib</targetPath>                         <includes>                             <include>**/*.jar</include>                         </includes>                     </resource>                 </webResources>             </configuration>         </plugin>          <plugin>             <artifactId>maven-compiler-plugin</artifactId>             <configuration>                 <source>1.6</source>                 <target>1.6</target>             </configuration>         </plugin>     </plugins> </build> 
vote vote


The Oracle JDBC Driver is now available in the Oracle Maven Repository (not in Central).

<dependency>     <groupId></groupId>     <artifactId>ojdbc7</artifactId>     <version></version> </dependency> 

The Oracle Maven Repository requires a user registration. Instructions can be found in:

Update 2019-10-03

I noticed Spring Boot is now using the Oracle JDBC Driver from Maven Central.

<dependency>     <groupId></groupId>     <artifactId>ojdbc10</artifactId>     <version></version> </dependency> 

For Gradle users, use:

implementation '' 

There is no need for user registration.

Update 2020-03-02

Oracle is now publishing the drivers under the group id. See Anthony Accioly answer for more information. Thanks Anthony.

Oracle JDBC Driver compatible with JDK6, JDK7, and JDK8

<dependency>   <groupId></groupId>   <artifactId>ojdbc6</artifactId>   <version></version> </dependency> 

Oracle JDBC Driver compatible with JDK8, JDK9, and JDK11

<dependency>   <groupId></groupId>   <artifactId>ojdbc8</artifactId>   <version></version> </dependency> 

Oracle JDBC Driver compatible with JDK10 and JDK11

<dependency>   <groupId></groupId>   <artifactId>ojdbc10</artifactId>   <version></version> </dependency> 
vote vote


Download the jar and place it in your project src/lib. Now you can use the maven installer plugin.

<plugin>     <groupId>org.apache.maven.plugins</groupId>     <artifactId>maven-install-plugin</artifactId>     <version>2.3.1</version>     <executions>         <execution>             <id>install-oracle-jdbc</id>             <goals>                 <goal>install-file</goal>             </goals>             <phase>clean</phase>             <configuration>                 <groupId></groupId>                 <artifactId>ojdbc6</artifactId>                 <version>11.2.0</version>                 <packaging>jar</packaging>                 <generatePom>true</generatePom>                 <createChecksum>true</createChecksum>                 <file>${project.basedir}/src/lib/ojdbc6.jar</file>             </configuration>         </execution>     </executions> </plugin> 

Now you only have to execute mvn clean once and the oracle lib is installed in your local maven repository.

vote vote


Oracle is now exposing a maven repository at However you need to be authenticated.


According to the comments in the blog post the ojdbc driver should be available at the following coordinates:

<groupId></groupId>  <artifactId>ojdbc7</artifactId>  <version>12.1.3-0-0</version>  <packaging>jar</packaging> 

Top 3 video Explaining java - Find Oracle JDBC driver in Maven repository