Reputation: 7688
I have an Android application that runs on a Samsung Galaxy tab. It modifies a SQLite database. I can read and write the database without issues on the tablet. I copy the database to Windows and attempt to read it with SQLite3 (the latest, version 3.7.10, precompiled binary downloaded from http://www.sqlite.org/download.html). When I try to do anything with the database (".tables") using sqlite3.exe I get "Error: database disk image is malformed".
Interestingly, when I try to read the database using SQLiteBrowser 2.0 b1 (http://sourceforge.net/projects/sqlitebrowser/) which links against SQLite 3.6.18, it can read the database without a problem.
I'm guessing that the database is really getting corrupt and both Windows SQLite 3.6.18 and whatever version of SQLite is on the Samsung Galaxy is more forgiving than the latest version of SQLite.
Anyone run into this before and give me hints regarding how/why the database is getting corrupt on Android? Or should I just use version 3.6.18 on Windows? Scares me a bit as I'm concered there really is corruption going on.
Upvotes: 3
Views: 2426
Reputation: 35661
This can also happen if the database is using WAL but you are using a version of Sqlite that predates this feature.
Upvotes: 1
Reputation: 7688
The database is getting cropped when it's copied off the device. SQLite 3.6.18 isn't smart enough to notice it, but SQLite 3.7.10 is. The reason it's getting cropped is here: Flush MTP connection with Android tablet?
Upvotes: 0