1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

unable to connect to mdb file using eclipse

Discussion in 'Java' started by girish979, Jan 13, 2010.

Thread Status:
Not open for further replies.
  1. girish979

    girish979 New Member

    Joined:
    Nov 18, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    Im trying to connect to MsAccess file using Eclipse, but im getting the error
    Code:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.
    I have added the ojdbc14.jar to Bulid Path for the project & the access file is in the Bin Folder.

    & this is the code
    Code:
    try
            {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    
                           Connection con = DriverManager.getConnection("jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=testdb2.mdb","","");
                
                      
                Statement stmt = con.createStatement();
                String s = "insert into student values(521,'test1');";
                stmt.executeUpdate(s);
                con.commit();
                stmt.close();
                con.close();
                
                
            }
            catch(Exception e)
            {
    
                System.out.println(e);
                
            }
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
Thread Status:
Not open for further replies.

Share This Page