Database corruption

Symptom

Your database may be corrupt if it:

  • Generates the following errors:

    • SQLE_DEVICE_ERROR
    • SQLE_DATABASE_ERROR (can also be a symptom of other issues)
    • SQLE_MEMORY_ERROR (can also be a symptom of other issues)
  • Crashes or returns invalid query results.

Explanation

There are two more typical causes corruption:

  • The more frequent cause occurs if the device has problems storing the file, thereby spuriously changing the contents of it. This issue usually stops the database from functioning fairly quickly.

  • The less frequent cause occurs if an error in the UltraLite code fails to maintain an index correctly. These issues can go undetected for much longer because the change to the results of a query are more subtle.

Recommendation

Checksums are used to detect offline corruption, which can help reduce the chances of other data being corrupted as the result of a bad critical page. If a checksum validation fails when the database loads a page, UltraLite immediately stops the database and reports a fatal error. This error cannot be corrected. Instead you must:

  1. Report the error to iAnywhere. It is helpful if you know the sequence of events that caused the corruption to occur, and if the error is reproducible.

  2. If you need the data, unload the contents of the database to a file.

  3. Create a new database.

  4. Repopulate the data either by synchronizing or by loading the unloaded data.

See also