Java – Connect oracle 11g database using java 1.7

javaoracle11g

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

Best Answer

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.

Related Topic