aspose file tools*
The moose likes JDBC and the fly likes Classpath in JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Classpath in JDBC" Watch "Classpath in JDBC" New topic
Author

Classpath in JDBC

Asad Salim
Greenhorn

Joined: May 31, 2011
Posts: 13
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

Joined: May 16, 2011
Posts: 62

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.


Cheers, Joy [SCJP 1.4, SCBCD 5.0]
get high on alcohol, algorithm or both
Asad Salim
Greenhorn

Joined: May 31, 2011
Posts: 13
Thanks Joy , that did solve my problem
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Classpath in JDBC