DroidDB Tip of the Month

DroidDB® Tip for March 2013

Preventing and Recovering From "database disk image is malformed" Errors

When a handheld connects to a desktop as a "portable device", the handheld device controls how desktop applications can access the files on the handheld. One thing the handheld dis-allows is direct modification of a file on the handheld by a desktop application. If a desktop application wants to modify a file on the handheld, it has to copy the file to the desktop, modify it, and then copy it back to the handheld.

It is possible that, while a desktop application is modifying its copy of a file, a handheld application modifies the original file. When the desktop application copies the file back to the handheld, the changes made by the handheld application can get lost.

Furthermore, when changes are made by a handheld application to a file, some of these changes may not be visible to desktop applications until the handheld is disconnected and then reconnected to the desktop.

All this can cause a handheld file to become "malformed". There are things you can do to prevent a file from becoming malformed. And, if your database gets malformed, there are ways to recover.

Preventing a Malformed Database

There are two basic rules to follow to prevent malformed databases:

  1. Always close DroidDB on the desktop before disconnecting the handheld.
  2. Don't run a DroidDB form on the handheld while the handheld is connected to the desktop (in other words: close DroidDB on the desktop (if it is open), disconnect the handheld from the desktop, run the form, close the form, and then reconnect the handheld to the desktop).

Recovering a Malformed Database

If a database becomes malformed, the data in the database is lost and it is not recoverable. You can, however, recreate the tables and indexes in the database. To do this:

  1. If DroidDB is open on the dektop, close it.
  2. Connect the handheld to the desktop if not already connected
  3. Remove the database file from the application folder. This is a file with the same name as the application and has a .DB extension. When in the desktop file explorer, they are usually described as a "Database file". Be careful to only remove the .DB file but not the .DDB files.
  4. Open DroidDB on the desktop and open the application. DroidDB will see that there is no database and it will create an empty one.
  5. For each form in the application, do a FILE | OPEN to open the form and then FILE | SAVE. The definition of the strucure of the tables is stored in the forms and this will cause DroidDB to recreate the table using this stored definition.

 

Back to List »

Visit our store

Top rated! I needed a solid database application development tool for mobile devices. I chose DroidDB for Android OS because it provided a way to get a strong product to market quickly. DroidDB is relational, gives me control over form layout, handles macros, and supports events. It works on all Android versions I have tried and is a great companion product to SYWARE’s VisualCE.

Mark Read, President
SyntegraTech, Inc.

signup for our newsletter