Database data media error by setRecord via ODBC



  • Hello,
    I work with a MS-Access-Database via ODBC driver. All worked perfectly for many months. Now I get sometimes the following error:

    [Microsoft][ODBC-Treiber für Microsoft Access] Datenträger Ein-/Ausgabefehler während des Einlesens. QODBC3: Unable to execute statement
    I translate the German part of the message:
    "Data media error I/O-error during reading in"

    It looks that we have a harddisk or network problems during a file operation. (the Access-DB in on the server)

    What is unexpected for me is the Qt function that produces the error: setRecord or insertRecord

    QSqlTableModel t(NULL, myDB);
    t.setTable(tblname);
    ok=t.select();
    
    QSqlRecord rec;
    //// fill record  fields
    ok=t.setRecord(0, rec);       // -> here I get the error
    // or  ok=t.insertRecord(0, rec);           
      if(!ok)
                {  // error-ouput -> exit }
       ok=t.submitAll();
    

    Makes setRecord something with the real database file ?
    I thought the setRecord/insertRecord work only in RAM and fills only the logical representation of the record in the memory.
    Only submitAll() make a data transport to the real database file and can produce a file error!

    Do I misunderstand it completely ?


  • Lifetime Qt Champion

    Hi,

    It depends on the edit strategy. AFAIK, by default it's OnRowChange for the QSqlTableModel.



  • @SGaist said in Database data media error by setRecord via ODBC:

    Hi,

    It depends on the edit strategy. AFAIK, by default it's OnRowChange for the QSqlTableModel.

    Ok, I have checked it. I have switched it to OnManualSubmit. Now, I get on submitAll() the error. That is clear now, nevertheless I get this error.

    I looked with the "Process Monitor Tool" on the Access database file during my running application and found that there is an periodical reading access every 500 ms the whole time.
    This is unexpected for me again. The program "stands" and performes no database action. It only has connected to the DB and hold the connection (dont close it).
    I this the normal behavioral the a QSqlDatabase or is somesthing wrong here ???


  • Lifetime Qt Champion

    I haven't used that plugin so I can't comment on that behaviour.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.