5 Replies Latest reply: Jun 18, 2014 6:37 AM by gimbal2 RSS

    ClassNotFoundException in sun.jdbc.odbc.JdbcOdbcDriver

    51de6cc3-8ad7-4689-acbc-a3ab0b60b255

      Hi Experts,

       

        I am new to Java Programming..and trying to learn the nuances of the language from industry experts...

       

        As a beginner in JDBC programming, I am trying to establish a simple connection to the MS Access DB (2007) from my app...but all I am getting is Exceptions...ClassNotFoundException and SQLException (no suitable drivers)...??

       

      I have my classpath variable set to the  JRE lib ...

      Code::-

      import java.sql.*;

      import java.lang.Class.*;

      class sample {

        String  url;

        Connection con;

         sample(){

             try{

                      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

        url = "jdbc:odbc:;Driver={Microsoft Access Driver (*.accdb)}; DBQ=C:\\Program Files\\Java\\mandeep\\newdata.accdb";

        con = DriverManager.getConnection(url);

        System.out.println("connection established");

                       }

       

       

                  catch(Exception e){

                  System.out.println(e.getCause().getMessage());

                   }

                  }

       

                

         public static void main (String[] args) throws Exception {

        sample s = new sample();

       

                    

                     

        }

      }

       

      PLEASE HELP!!

       

      Mandeep