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