Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MS Access (http://www.go4expert.com/forums/ms-access-forum/)
-   -   Unable To Connect To Access File Using Eclipse (http://www.go4expert.com/forums/unable-connect-access-file-using-eclipse-t20652/)

girish979 13Jan2010 08:02

Unable To Connect To Access File Using Eclipse
 
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);
           
        }

any idea??

girish979 13Jan2010 08:06

Re: Unable To Connect To Access File Using Eclipse
 
And when i used the CMD to compile i didnt get any errors & im able to execute.
& i can retrieve the data, but when i insert something it is not being updated in access file.


All times are GMT +5.5. The time now is 22:45.