使用Java 1.7连接Oracle 11g数据库 [英] Connect oracle 11g database using java 1.7
问题描述
请帮助我.我已经在Windows 7(32位)上安装了Oracle 11g,我正在尝试使用jdk 1.7连接数据库
Please help me.I have installed Oracle 11g on Windows 7 (32 bit) and i'm trying to connect database with jdk 1.7
但我收到一条错误消息
软件包oracle.jdbc.driver不存在
package oracle.jdbc.driver does not exist
Oracle 11g安装在E:驱动器中.
Oracle 11g is installed in E: Drive.
我已指出我的Path和CLASSPATH如下
I have pointed my Path and CLASSPATH as following
CLASSPATH
CLASSPATH
C:\ Program Files \ Java \ jdk1.7.0
C:\Program Files\Java\jdk1.7.0
E:\ app \ malisa \ product \ 11.2.0 \ dbhome_1 \ jdbc \ lib
E:\app\malisa\product\11.2.0\dbhome_1\jdbc\lib
以下jar文件位于位置E:\ app \ malisa \ product \ 11.2.0 \ dbhome_1 \ jdbc \ lib
The following jar files are in the location E:\app\malisa\product\11.2.0\dbhome_1\jdbc\lib
ojdbc5
ojdbc5_g
ojdbc5dms
ojdbc5dms
ojdbc5dms_g
ojdbc5dms_g
ojdbc6
ojdbc6_g
ojdbc6dms
ojdbc6dms
ojdbc6dms_g
ojdbc6dms_g
简单粉丝
预先感谢
玛丽莎
推荐答案
仅指定目录不会将该目录中的jar文件添加到类路径中.您必须像这样将jar文件显式添加到您的类路径-
Specifying just a directory does not add the jar files in that directory to the classpath. You must add the jar file explicitly to your classpath like so --
E:\app\malisa\product\11.2.0\dbhome_1\jdbc\lib\ojdbc.jar
或者,如果您想添加多个jar文件,则可以使用这样的通配符
Or if you want to add multiple jar files, then you could use wildcards like this
E:\app\malisa\product\11.2.0\dbhome_1\jdbc\lib\*
看看如何在Java中设置类路径7 .
这篇关于使用Java 1.7连接Oracle 11g数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!