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

Download ucanaccess Driver – Link http://ucanaccess.sourceforge.net/site.html

import java.sql.*;
class Test{
public static void main(String ar[]){
 try{
   String database="student.mdb";//Here database exists in the current directory

   String url= "jdbc:ucanaccess://student.mdb";

   Connection c=DriverManager.getConnection(url);
   Statement st=c.createStatement();
   ResultSet rs=st.executeQuery("select * from login");

   while(rs.next()){
    System.out.println(rs.getString(1));
   }

}catch(Exception ee){System.out.println(ee);}

}}

 

These Lines are important.

String database=”student.mdb”;//Here database exists in the current directory

String url= “jdbc:ucanaccess://student.mdb”;

Connection c=DriverManager.getConnection(url);

Watch Video for Better UnderStanding.

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s