Android Question Database Problem

Discussion in 'Android Questions' started by hogiebaer, Jun 16, 2015.

  1. hogiebaer

    hogiebaer Active Member Licensed User

    i have a big problem with a customer database.

    The db contains 9 tables and has a size from 10mb. One table has 24500 records and seems corrupted.
    The request "select * from [table] where .... order by [field1],[field2] limit 100" ends with the
    error "database disk image is malformed...."

    And now the horror !
    In one case the database doesn´t exist after the request in the file.dirdefaultexternal and in the
    other try the database exist, but the size is only 28KB and 5 from 9 tables MISSING !!
    (for testing i have copied the saved 10mb database back)

    whats wrong ??
    thx
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    How are you copying it to File.DirDefaultExternal?
     
  3. hogiebaer

    hogiebaer Active Member Licensed User

    the original db is self created througth the app and the copy is done with a standard filemanager app to a self created directoy in file.dirdefaultexternal
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    You are creating a 10mb database at runtime?
     
  5. hogiebaer

    hogiebaer Active Member Licensed User

    yes, because in 1 table are the complete sales with date and customer. it´s an app for restaurants. and i need the table for reporting.

    After installation of the app the tables empty ;)
     
    Last edited: Jun 16, 2015
  6. Erel

    Erel Administrator Staff Member Licensed User

    When does the file become corrupted?
     
  7. hogiebaer

    hogiebaer Active Member Licensed User

    yesterday, i think an external power problem causes. the problem isn´t that the file is corrupt. this can be solved through export, create new db and import functionality.

    !! The real problem is, that an easy READ request to this table with "select" KILLS/DELETE THE DATABASE or modify the physical size !!
     
    Last edited: Jun 16, 2015
  8. Peter Simpson

    Peter Simpson Well-Known Member Licensed User

    Here you go @hogiebaer try this, it's earlier for me to just give you this link rather then try to explain it to you. I really hope that this helps you.
    http://wiki.team-mediaportal.com/1_MEDIAPORTAL_1/16_Support/Troubleshooting/Repair_SQLite_Database

    I hope that the following help you for further projects.
    BTW for restaurants etc my apps connect directly MySQL servers (onsite) rather than having all that data stored on a single device. If the end user is mobile (delivery company), my app stores the information locally on an SQLite database then synchronises to an MySQL database when the signal is at 50%. I just do not store large amounts of data on a single device, you never know what might happen.
     
  9. hogiebaer

    hogiebaer Active Member Licensed User

    Thx Peter, it´s an easy way to repair db´s. And you are right, if you say, the amount of record could be to big; and transfer the data to another "store".
    But it doen´t explain the failure

     
Loading...