ClassNotFound Exception for jdbc "uncanaccess" path setting for MS Access

42 views Asked by At

I am writing a very simple code to connect MS Access database to my java program using netBeans. The driver ucanaccess and MS access file is placed in the very same folder. Kindly guide me through it.

 public static void main(String[] args) {
    // TODO code application logic here
    Connection c = null;
    Statement s = null;
    ResultSet rs = null;
    try{
         Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
    c = DriverManager.getConnection("jdbc:ucanaccess://First1.accdb");
    s = c.createStatement();
    s.executeUpdate("insert into std values(5, 'junaid')");
    //set classpath=.c:./*;
    }catch(Exception e)
    {
        System.out.println(e);
    }

}
0

There are 0 answers