1

I searched a lot about this error but no solution works.

I'm just learning Java connection with Oracle.

But I'm getting this exception.

    oracle.jdbc.driver.OracleDriver

I already placed ojdbc6.jar in C:\Program Files\Java\jre1.8.0_60\lib\ext now what to do next?

In few days ago I was working fine with database. But recently 2 days ago I reinstall windows not forgot how to setup it.

Here is Complete StackTrace.

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at RunQuery.main(RunQuery.java:11)
  • Can you please post the full stack trace? Was it ClassNotFoundException? – simdevmon Apr 15 '16 at 07:59
  • @simdevmon question updated. –  Apr 15 '16 at 08:01
  • Possible duplicate of http://stackoverflow.com/questions/12493764/jar-file-does-not-load-class-files-from-ext – simdevmon Apr 15 '16 at 08:03
  • have you placed java in your system's PATH ? – svarog Apr 15 '16 at 08:03
  • @svarog I think so, that's why I'm running javac and java commands. –  Apr 15 '16 at 08:04
  • You shouldn't put DB driver jar in under JDK folder, you need to provide in classpath or server lib or inside your war file. – Viraj Apr 15 '16 at 08:08
  • @Viraj I'm not using any war file. I have just installed Oracle and then connecting to Java. in simple code. one line Class.forName(); just checking the driver first. –  Apr 15 '16 at 08:09

1 Answers1

0

Please check this Setting multiple jars in java classpath link for adding third party jar (ojdbc6.jar) while running Java program.

and I suggest you to use latest driver jar which is compatible to JDK 8, You can check on this FAQ link http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#01_02

Community
  • 1
  • 1
Viraj
  • 1,360
  • 3
  • 18
  • 38
  • viraj I already placed `ojdbc14.jar` also but that is also not working. -_- –  Apr 15 '16 at 08:18
  • 2) For JDK 7 & 8, you should use ojdbc7.jar and 1) java -cp "locationToYourJAR/ojdbc7.jar" yourpackage.yourmaninmethodclass like this you need to execute your program. if this still not working, Please share your screen shot of folder structure and output. – Viraj Apr 15 '16 at 08:28
  • can you visit it please? http://stackoverflow.com/questions/36641994/oracle-installation-product-folder-and-diag-folder-in-different-place –  Apr 15 '16 at 08:30