Results 1 to 2 of 2
  1. #1
    Marcus is offline Member
    Join Date
    Jun 2007
    Posts
    92
    Rep Power
    0

    Exclamation java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver

    This error appears in websphere console

    Java Code:
    java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver 
          at java.net.URLClassLoader.findClass(URLClassLoader.java:374) 
          at java.lang.ClassLoader.loadClass(ClassLoader.java:562) 
          at sun.misc.Launcher$AppClassLoader.loadClass 
    (Launcher.java:438) 
          at java.lang.ClassLoader.loadClass(ClassLoader.java:494) 
          at java.lang.Class.forName1(Native Method) 
          at java.lang.Class.forName(Class.java:176) 
          at opp2New.Conexion.getConnection(Connection.java:39) 
          at opp2New.BibliotecaBeans.listTheBooks(BibliotecaBeans.java:53) 
          at opp2New.Test.main(Test.java:23) 
    Exception in thread "main" java.lang.NullPointerException 
          at opp2New.BibliotecaBeans.listTheBooks(libraryBeans.java:53) 
          at opp2New.Test.main(Test.java:23)

    and my class of connection is

    Java Code:
    package opp2New; 
     
    import java.io.*; 
    import java.sql.*; 
    import java.util.*; 
     
    public final class Connection { 
     
          private static Connection  instance; 
          Connection con = null;       
          /** 
          *  
          */ 
          private Connection (){       
          } 
           
          public static Connection getInstance() { 
                 
                if(instance==null) 
                   instance = new Connection(); 
                    
                return instance;    
                } 
           
          public Connection getConnection(){ 
           
                try { 
                      Class.forName 
    ("sun.jdbc.odbc.JdbcOdbcDriver").newInstance(); 
                       
                      String url="jdbc:odbc:library"; 
                      con = DriverManager.getConnection 
    (url,"db2admin","db2admin"); 
                } catch (SQLException e) { 
                      // TODO Auto-generated catch block 
                      e.printStackTrace(); 
                } catch (InstantiationException e) { 
                      // TODO Auto-generated catch block 
                      e.printStackTrace(); 
                } catch (IllegalAccessException e) { 
                      // TODO Auto-generated catch block 
                      e.printStackTrace(); 
                } catch (ClassNotFoundException e) { 
                      // TODO Auto-generated catch block 
                      e.printStackTrace(); 
                } 
          return con; 
          } 
           
          public void close_Connection()throws SQLException{ 
                      con.close(); 
                            } 
    }
    please if somebody can help me I would be great.

    Marcus

  2. #2
    Daniel is offline Member
    Join Date
    Jun 2007
    Posts
    91
    Rep Power
    0

    Default

    Did You load the Driver in java build path?

    java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver

    Daniel

Similar Threads

  1. Replies: 6
    Last Post: 02-19-2010, 02:57 PM
  2. Replies: 0
    Last Post: 03-21-2008, 02:13 PM
  3. java.lang.ClassNotFoundException
    By ravian in forum New To Java
    Replies: 1
    Last Post: 01-07-2008, 11:31 AM
  4. Replies: 1
    Last Post: 07-24-2007, 12:54 AM
  5. Replies: 1
    Last Post: 07-14-2007, 06:59 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
  •