Different results when I am using ODBC and UcanaccessDriver in the same .mdb

Help
MQG-Brazil
2014-03-24
2014-03-27
  • MQG-Brazil
    MQG-Brazil
    2014-03-24

    Hi Guys, congrats for your great job, UcanAccess have helped us a lot!!!

    So, We've faced with this situation: When we were using ODBC we get 300 registers and When we were using UcanaccessDriver we get 295 registers in the same archive .mdb that is not corrupted (we've opened this archive by MS Access without error or warning)... so we thought a bit more and we tried using the "repair and fix" from the MS Access and for our surprise we've got the 300 registers with UcanaccessDriver after using "repair and fix" of the .mdb by MS Access. This is a known behaviour?

    public Connection getConnUCANACCESS() throws UcanaccessSQLException {
    
       Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
    
       String url = "C:\\bd-000-00.mdb;";
       String usu = "Admin";
       String pass = "sh000";
    
        String urlU = UcanaccessDriver.URL_PREFIX + url + ";newDatabaseVersion=V2003";
    
        return DriverManager.getConnection(urlU, usu, pass);
    }
    public Connection getConnODBC() throws ClassNotFoundException, SQLException {
    
       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    
       String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\bd-000-00.mdb;Uid=Admin;Pwd=sh000;";
    
       Properties props = new Properties();
       props.put("charSet", "ISO-8859-1");
    
       return DriverManager.getConnection(url, props);
    }
    public static void main(String[] args) throws UcanaccessSQLException, SQLException, ClassNotFoundException {
    
       Connection cnn = null;
       PreparedStatement pst = null;
       ResultSet rs = null;
    
       UcanAccessDAO ucan = new UcanAccessDAO();
       cnn = ucan.getConnUCANACCESS();
       pst = getSql(cnn);
       rs = pst.executeQuery();
    
       int count = ucan.getQtd(rs); // the qtd from UcanAccess
    
       System.out.println(count);
    
       // finish him!
       pst.clearParameters();
       rs.clearWarnings();
       cnn.close();
    
       // NOW WITH ODBC....
       cnn = ucan.getConnODBC();
       pst = getSql(cnn);
       rs = pst.executeQuery();
    
       int count2 = ucan.getQtd(rs); // the qtd from ODBC
    
       System.out.println(count2);
    
       // finish him!
       pst.clearParameters();
       rs.clearWarnings();
       cnn.close();
     }
    

    And to things to be more hard... this job must run on Windows XP 32 bits. (ohh Lord!)

    thanks for your time guys! Regards.

     
  • Marco Amadei
    Marco Amadei
    2014-03-24

    Hi MQG-Brazil,
    thank you for your interest in UCanAccess!
    Unfortunatly it isn't a known behaviour.
    In order to reproduce it, it would be very helpful to have the original mdb (or a mdb with a minimal subset of the tables). Is it possible?
    On the way, are you using the 2.0.3?
    Cheers Marco

     
    Last edit: Marco Amadei 2014-03-24
  • Marco Amadei
    Marco Amadei
    2014-03-27

    I answered on stackoverflow.
    Cheers Marco