Results 1 to 14 of 14
  1. #1
    Bean is offline Member
    Join Date
    Nov 2009
    Posts
    9
    Rep Power
    0

    Default JDBC Oracle Connection

    I've searched, and tried many things, but cannot get an Oracle connection to work on our server...it works on my developement PC, but I move my .jar to the server and I get:

    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/Oracle Driver

    I started out with just the JRE installed, but have since installed the JDK in hopes that would solve it. I have copied both "classes111.jar" and "ojdbc.jar" to C:\Program Files\Java\jdk1.6.0_17\lib.

    Most fixes for this error are "check your environment variables"...I've checked them and tried many things but no go...here's that they look like:

    PATH=.; C:\Program Files\Java\jdk1.6.0_17\lib;C:\Program Files\Java\jdk1.6.0_17\lib\classes111.jar; C:\Program Files\Java\jre6\lib;D:\oracle\ora92\;D:\oracle\ora 92\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\ WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\DMIX


    CLASSPATH=C:\Program Files\Java\jdk1.6.0_17\lib; C:\Program Files\Java\jdk1.6.0_17\lib\classes111.jar

    Is there anyone that can help me troubleshoot this???!

  2. #2
    Bean is offline Member
    Join Date
    Nov 2009
    Posts
    9
    Rep Power
    0

    Default

    I probably should have mentioned a few more things, i am using Eclipse on my dev PC (wiht WinXP), and the server is Win2K3 Server, with the Oracle 9i client installed.

  3. #3
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Don't put that jar file in the JDK's folders or on your system's path. It only needs to be on your program's classpath.

  4. #4
    Bean is offline Member
    Join Date
    Nov 2009
    Posts
    9
    Rep Power
    0

    Default

    I put my jar in

    C:\alfa.jar

    So I need to have the classes111.jar in that same directory?...and then change CLASSPATH to that location?

    Then run

    c:\java -jar alfa.jar

    Tried that but still get the same error...

  5. #5
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    You then need to provide

    -cp classes111.jar

  6. #6
    Bean is offline Member
    Join Date
    Nov 2009
    Posts
    9
    Rep Power
    0

    Default

    Tried that...still same error.
    :(

    I do appreciate you help

  7. #7
    Bean is offline Member
    Join Date
    Nov 2009
    Posts
    9
    Rep Power
    0

    Default

    We might be making progress though, because this does not work:

    c:\java oracle.jdbc.driver.OracleDriver

    but this does:

    c:\java -cp classes111.jar oracle.jdbc.driver.OracleDriver

  8. #8
    Bean is offline Member
    Join Date
    Nov 2009
    Posts
    9
    Rep Power
    0

    Default

    Does the JDK have to be installed to use JDBC?

    Does the Oracle Client?

  9. #9
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Quote Originally Posted by Bean View Post
    We might be making progress though, because this does not work:

    c:\java oracle.jdbc.driver.OracleDriver

    but this does:

    c:\java -cp classes111.jar oracle.jdbc.driver.OracleDriver
    Please read the manual for the java command. What class file are you trying to run? That's the one you provide to java. You are currently running the oracle driver class which is surely not what you intend to do. Run your class file but provide the classes111.jar as a classpath argument i.e

    c:\java -cp classes111.jar YourClassThatUsesTheOracleDriver

  10. #10
    Bean is offline Member
    Join Date
    Nov 2009
    Posts
    9
    Rep Power
    0

    Default

    Yes, I understand that...but I had read somewhere that if your Oracle connection is failing that you can troubleshoot by simply trying the command:

    java oracle.jdbc.driver.OracleDriver

    and see what you get. If you get a:

    "main" not found

    then the Oracle Driver can be found, and the problem is elsewhere...if you get:

    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/Oracle Driver

    then theres something wrong with the environment. I was just trying to troubleshoot. The class file I am trying to run is named ALFA.jar, it currently resides in C:\ on the server. So I try:

    c:\java -cp classes111.jar ALFA.jar

    and I get the Error:

    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/OracleDriver

    ???

    thanks for the help

  11. #11
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    What happened to the -jar option?

  12. #12
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    808
    Rep Power
    6

    Default

    just check it in command line javap oracle.jdbc.OracleDriver to make sure jar file is in path
    Ramya:cool:

  13. #13
    Bean is offline Member
    Join Date
    Nov 2009
    Posts
    9
    Rep Power
    0

    Default sry

    Quote Originally Posted by r035198x View Post
    What happened to the -jar option?
    Yes, sorry I am using that...jsut typed it wrong into the forum...I am issueing this command:

    c:\java -cp classes111.jar -jar ALFA.jar

    and I get the Error:

    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/OracleDriver

  14. #14
    Bean is offline Member
    Join Date
    Nov 2009
    Posts
    9
    Rep Power
    0

    Default

    Quote Originally Posted by RamyaSivakanth View Post
    just check it in command line javap oracle.jdbc.OracleDriver to make sure jar file is in path
    If I type:

    c:\javap oracle.jdbc.OracleDriver

    I get:

    'javap' is not recognized as an internal or external command...

    ???

Similar Threads

  1. oracle JDBC java
    By silia_motor in forum JDBC
    Replies: 4
    Last Post: 05-10-2009, 09:37 AM
  2. connection with Oracle 10g
    By Somitesh Chakraborty in forum New To Java
    Replies: 5
    Last Post: 11-20-2008, 07:19 PM
  3. Using JDBC to connect to ORACLE database
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-10-2008, 11:27 AM
  4. Jdbc Driver For Oracle
    By Swamipsn in forum New To Java
    Replies: 0
    Last Post: 08-14-2007, 04:31 AM
  5. Oracle and JDBC
    By Eric in forum JDBC
    Replies: 3
    Last Post: 08-11-2007, 08:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •