Click here to Skip to main content
15,899,475 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My coding is:-


Java
public class Withoutdsn {

    public static void main(String[] args) 
    {
        try
        {
        String database="dsn.accdb";//Here database exists in the current directory

        String url="jdbc:odbc:Driver={Microsoft Access Driver(*.mdb,*.accdb)};DBQ=" + database + 

";DriverID=22;READONLY=false";

        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection c=DriverManager.getConnection(url,"","");
        Statement st=c.createStatement();
        ResultSet rs=st.executeQuery("insert into login values('Anoop','Delhi')");
  
  
        }
        catch(Exception e)
        {
            System.out.println(e);
        }
    }
}



Getting Error [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified. I have 32 bit OS. I am unable to find my error.Please help me. I am creating a project in which I want to Create a DSN-less connection for MS Access(.accdb).
If you have any code connecting .accdb file please Share.
Thanx in advance
Posted

Here is another helpful link Access MS-Access Databases from Java[^]
 
Share this answer
 
Connection strings for Access 2007[^] has a number of examples that might help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900