我遇到了一些问题ucp.jar
如果我ucp.jar
用于 oracle 12.1.0.1 它可以工作。
如果我使用 oracle 12.1.0.2 的版本,则会出现以下异常:
java.lang.ClassNotFoundException: oracle.jdbc.pooling.Factory
有谁能帮助我吗?
谢谢,毛罗
Jdbc (ojdbc7.jar) 和 UCP (ucp.jar) jar 必须始终来自同一版本 (12.1.0.2)。你不能升级一个而不升级另一个。这个版本依赖是在 12c 中引入的。以前不是这样的。
有一个 ojdbc7.jar/ojdbc6.jar 文件依赖项。您需要根据您使用的 java 版本下载/更新。
添加以下 Maven 依赖项为我解决了这个问题
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ucp</artifactId>
<version>12.1.0.2</version>
</dependency>
(1)注册(或拥有现有的 Oracle.com 帐户)
(2)访问http://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html
下载ojdbc8.jar
并udp.jar
添加到类路径。
(3)如果您使用构建工具(Maven 或 Gralde),请转到文件目录ojdbc8.jar
并upd.jar
mvn install:install-file -Dfile=udp.jar -DgroupId=com.oracle -DartifactId=udp -Dversion=12.1.0.1 -Dpackaging=jar
mvn install:install-file -Dfile=ojdbc8.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.1.0.1 -Dpackaging=jar
(4)如果你使用 Gradle,你必须在build.gradle
. 例子
plugins {
id 'java'
}
group 'com.donhuvy'
version '1.0-SNAPSHOT'
sourceCompatibility = 10
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile('com.oracle:ojdbc8:12.1.0.1')
compile('com.oracle:ucp:12.1.0.1')
testCompile group: 'junit', name: 'junit', version: '4.12'
}