简体   繁体   中英

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

but i get an error saying

package oracle.jdbc.driver does not exist

Oracle 11g is installed in E: Drive.

I have pointed my Path and CLASSPATH as following

CLASSPATH

C:\\Program Files\\Java\\jdk1.7.0

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_g

ojdbc6

ojdbc6_g

ojdbc6dms

ojdbc6dms_g

simplefan

Thanks in advance

Malisa

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

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\*

Take a look at how to set classpath in Java 7 .

You could put the JAR file in the JRE/lib/ext directory. That means it will be on the classpath of every Java application. This is a little heavy handed though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM