Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2009

    Unanswered: Cannot connect to Access 2007

    I am wandering how I can connect to Access 2007 with Java.

    I got an exception error for connecting to Access 2007 (.accdb) . However, I can connect to the Access file with the .mdb file. I am using window vista. I would like to know is there anything I need to configure to be able to connect to the Access (.accdb).

    Error:java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

    How do I specify a driver?

    had anyone experienced this problem and actually found a solution?

    Thank You

  2. #2
    Join Date
    Dec 2008
    Hope that is useful for you....
    //class definition
    private static DatabaseManagement instance = null;
    private String DB_URL="jdbc Driver={Microsoft Access Driver (*.mdb ,*.accdb)};DBQ=";
    private final String DB_DRIVER="sun.jdbc.odbc.JdbcOdbcDriver";
    private String filename="Jan.accdb";
    private Connection con=null;
    DB_URL+=filename.trim()+";DriverID=22;READONLY=tru e}";
    con = DriverManager.getConnection( DB_URL ,"","");
    it create the object in the main with new operator.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts