• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Classpath in JDBC

 
Asad Salim
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

I m confused where actually I m going wrong with the classpath settings in order to user JDBC-OracleDriver Connection

Below is my JAVA Code


CLASSPATH setting is :
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar

Path Setting is
C:\oraclexe\app\oracle\product\10.2.0\server\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files\Java\jdk1.6.0\bin;

JDK version is 1.6
Oracle version is Oracle 10g

My Code works perfect when i try to on command prompt using -cp , but it doesn't work on Eclipse , it cannot detect the classpath file (i guess so, although being specified)

It throws the below exception
Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at SampleDatabaseConn.main(SampleDatabaseConn.java:9)


Could you guys provide some inputs.

Thanks,
Asad.
 
joy b chakravarty
Ranch Hand
Posts: 62
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In eclipse add these jars in your build path.
Right click on your project > Build Path > Configure Build Path > Add the external jars

Or you might restart eclipse for it to pick up system env variables.
 
Asad Salim
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Joy , that did solve my problem
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic