How to use Maven to import Ojdbc14.jar and Ojdbc6.jar in MyEclipse environment

Source: Internet
Author: User
Tags oracle database

Ali database Connection Pool Druid connection Oracle 11g R2 error: not support Oracle Driver 1.0

1. Background and environment

These days in the tinkering Struts2+spring3+hibernate4+maven+easyui integration, JDK1.7, database using Oracle 11g R2, driven by Ojdbc14, The database connection pool uses Alibaba's Druid (the full package name is Com.alibaba.druid.pool.DruidDataSource), but when you do unit testing with JUnit, you report the following error:

caused By:java.sql.SQLException:not support Oracle Driver 1.0

2, Users and questions

Search on the internet for a long time, found initially published in the open source China has been reprinted a number of questions and answers:

Q: For the first time today, using Druid, the program launched the "Druid–not Support Oracle Driver 1.0", for various versions of the driver (including OJDBC6), are not. Is it because the version of the connected client is too low?

A: The temperature is said to be the right, because there are more than one driver package caused. Class12.jar was found under the Ext directory of the JRE.

3, this article method

I checked, found that my problem is not caused by this reason, but this article gave me a point of Revelation, is the database-driven version of the problem, and then replaced with Oracle 11g with the driver Ojdbc6.jar, the problem is resolved.

4, this article RELATED links

①druid Introduction: Alibaba database connection Pool Druid

How to use Maven to import Ojdbc14.jar and Ojdbc6.jar under Ojdbc6.jar:MyEclipse environment under ②maven

③oracle database-driven version changes: Oracle database-driven generations and their differences (CLASSES12,OJDBC14,OJDBC5,OJDBC6, etc.)

//------------------------------------------------------------------------------------------------------------- --------------------------------------------


Http://www.coridc.com/archives/2748.html

These days in the consolidation of Struts2+spring3+hibernate4+maven+easyui, using Oracle database, Oracle database driver using OJDBC14, later because the database connection pool using Alibaba's druid, There may be a version problem and replaced with OJDBC6. This paper mainly introduces the method of using Maven to import Ojdbc14.jar and Ojdbc6.jar in MyEclipse environment.

1, Ojdbc14.jar Import method:

<dependency>
<groupid>com.oracle</groupid>
<artifactid>ojdbc14</artifactid>
<version>10.2.0.4.0</version>
</dependency>

① is the same as importing other jar packages, in the project Pom.xml file, you can search for and import code using the Dependencies Wizard, and you can find that its group ID is com.oracle,artifact ID ojdbc14, The latest version is: 10.2.0.4.0, so you have the following code:

If there are other common packages, such as struts, Spring, Hibernate, and so on, even if the import succeeds at the end of this step, but for Oracle, that's not what we see, MyEclipse, The Pom.xml file has a red fork, because Oracle JDBC driver packages require Oracle's official authorization to be downloaded, Apache does not provide Ojdbc.jar public downloads (http://search.maven.org/), This can go down to MAVEN's local library directory, such as: C:\Users\Administrator\.m2\repository\com\oracle\ojdbc14\ 10.2.0.4.0, found that there is no ojdbc14-10.2.0.4.0.jar, to this end, we need to download from the Internet Ojdbc.jar

② Download the OJDBC14 package and execute the following statement on the command line:

MVN install:install-file-dgroupid=com.oracle-dartifactid=ojdbc14-dversion=10.2.0.4.0-dpackaging=jar-dfile=d:/ Extjar/ojdbc14.jar

After execution, we can C:\Users\Administrator\.m2\repository\com\oracle\ojdbc14\ in the directory 10.2.0.4.0 Find package Ojdbc14-10.2.0.4.0.jar, refresh project, success.

Note: 1 If you want to execute the above statement, you first need to configure the Java environment Variables and MAVEN environment variables, 2 note the above version number and Ojdbc.jar path;

2, Ojdbc6.jar Import method:

The biggest difference between the one by one point and the Ojdbc14.jar import method is that when we myeclipse the Pom.xml Dependencies Wizard search in the project, we can't find Ojdbc6.jar this package, where we can fix it as follows:

① write code directly in Pom.xml:

<dependency>
<groupid>com.oracle</groupid>
<artifactid>ojdbc6</artifactid>
<version>11.2.0.1.0</version>
</dependency>

② is the same as the Ojdbc14 method, executing:

MVN Install:install-file-dgroupid=com.oracle-dartifactid=ojdbc6-dversion=11.2.0.1.0-dpackaging=jar-dfile=d:\app \administrator\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6.jar

Complete.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.