Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2010
    Posts
    1
    Rep Power
    0

    Exclamation Unable to load Oracle Driver

    Hi

    I wish to connect to Oracle but I am unable to load the required JDBC driver.

    The following is the code for my program:-
    import java.sql.*;
    import java.sql.Connection;
    import java.sql.DriverManager;

    /**
    *
    * @author Shantanu
    */
    public class Main {

    public Main(){


    }
    /**
    * @param args the command line arguments
    */
    public static void main (String[] args)throws Exception {

    try
    {
    //ESTABLISHING A DATABASE CONNECTION
    //Loading the JDBC driver
    Class.forName("oracle.jdbc.driver.OracleDriver").n ewInstance();
    }
    catch(Exception e)
    {
    throw e;
    }

    }
    }
    I got the following exception:-
    Error: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
    at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at TestConnection.main(TestConnection.java:24)


    Following are my Classpath and Path details:-
    CLASSPATH: C:\oracle\ora92\jdbc\lib\ojdbc14.jar;C:\oracle\ora 92\jdbc\lib\classes12.jar;C:\oracle\ora92\jdbc\lib \classes111.jar;

    PATH: C:\Program Files\JavaFX\javafx-sdk1.2\bin;C:\Program Files\JavaFX\javafx-sdk1.2\emulator\bin;C:\bea\jdk142_04\bin;C:\oracle \ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;%SystemRoot%\system32;% SystemRoot%;%SystemRoot%\System32\Wbem;C:\PROGRA~1 \XRay;

    Am I missing out something here? Why can I not load the required driver when the JAR paths have been specified in the CLASSPATH?

    Thanks in advance for the help.

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

    Default

    Are you using Netbeans? You might need to add it to the project's build path inside Netbeans.

Similar Threads

  1. can't load the driver (hsqldb)
    By tomiu in forum JDBC
    Replies: 7
    Last Post: 06-09-2009, 11:23 PM
  2. load driver in javaDB
    By kulangotski in forum New To Java
    Replies: 1
    Last Post: 02-20-2009, 07:15 PM
  3. Jdbc Driver For Oracle
    By Swamipsn in forum New To Java
    Replies: 0
    Last Post: 08-14-2007, 04:31 AM
  4. Oracle Driver
    By softy in forum JDBC
    Replies: 1
    Last Post: 07-02-2007, 12:20 AM
  5. Oracle Driver
    By softy in forum Advanced Java
    Replies: 0
    Last Post: 06-28-2007, 02:23 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
  •