ho scritto questo metodo qua per connettermi a un file access:
codice:
    private String getCharComune() {
        String db = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + directory();
        String sql = "SELECT CF FROM Comuni WHERE Comune='" + comune + "'";
        try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
            Connection conn = DriverManager.getConnection(db, "", "");
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery(sql);
            if (rs.next()) {
                db = rs.getString(1);
            } else {
                db = "";
            }
            rs.close();
            stmt.close();
            conn.close();
        } catch (Exception e) {
            System.out.println(e);
        }
        return db;
    }
funziona solo windows.
su mac e linux no.

directory() è un metodo che mi ritorna il percorso del file a seconda di che os uso:
codice:
    public static String directory() {
        String path = new String();
        String os = System.getProperty("os.name");
        if (os.equals("Linux")) {
            path = "/media/MATTE/Utility/Comuni.mdb";
        } else if (os.equals("Mac OS") || os.equals("Mac OS X")) {
            path = "/Volumes/MATTE/Utility/Comuni.mdb";
        } else if (os.equals("Windows Vista") || os.equals("Windows 7") || os.equals("Windows XP")) {
            path = "E:\\Utility\\Comuni.mdb";
        }
        return path;
    }
l'ho usato anche in altri progetti e nn ho mai avuto problemi.