[英]Connect oracle 11g database using java 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 请帮帮我。我已经在Windows 7(32位)上安装了Oracle 11g,并且我正在尝试使用jdk 1.7连接数据库。
but i get an error saying 但我说错了
package oracle.jdbc.driver does not exist 软件包oracle.jdbc.driver不存在
Oracle 11g is installed in E: Drive. Oracle 11g安装在E:驱动器中。
I have pointed my Path and CLASSPATH as following 我已经指出了我的Path和CLASSPATH如下
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:\\程序\\玛丽萨\\产品\\ 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 以下jar文件位于位置E:\\ app \\ malisa \\ product \\ 11.2.0 \\ dbhome_1 \\ jdbc \\ lib
ojdbc5 ojdbc5
ojdbc5_g ojdbc5_g
ojdbc5dms ojdbc5dms
ojdbc5dms_g ojdbc5dms_g
ojdbc6 ojdbc6
ojdbc6_g ojdbc6_g
ojdbc6dms ojdbc6dms
ojdbc6dms_g ojdbc6dms_g
simplefan simplefan
Thanks in advance 提前致谢
Malisa 玛丽萨
Specifying just a directory does not add the jar files in that directory to the classpath. 仅指定目录不会将该目录中的jar文件添加到类路径。 You must add the jar file explicitly to your classpath like so --
您必须像这样将jar文件显式添加到您的类路径中-
E:\app\malisa\product\11.2.0\dbhome_1\jdbc\lib\ojdbc.jar
Or if you want to add multiple jar files, then you could use wildcards like this 或者,如果您想添加多个jar文件,则可以使用这样的通配符
E:\app\malisa\product\11.2.0\dbhome_1\jdbc\lib\*
Take a look at how to set classpath in Java 7 . 看一下如何在Java 7中设置类路径 。
You could put the JAR file in the JRE/lib/ext directory. 您可以将JAR文件放在JRE / lib / ext目录中。 That means it will be on the classpath of every Java application.
这意味着它将位于每个Java应用程序的类路径中。 This is a little heavy handed though.
不过这有点费力。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.