• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Classpath in JDBC

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 62
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Joy , that did solve my problem
 
reply
    Bookmark Topic Watch Topic
  • New Topic