android sqllite database disk image is malformed

  最近遇到类似下面的问题,

  解决办法:
终极的原因是你复制的.db没有真正的复制到你的另一个设备上,表象看起来是,有些设备报这个问题,有些设备没有问题。
是用蓝牙发到我手机上,再复制的。小心,文件复制不同步的问题。

I thought of that too and I tried doing that. It says: "An error occurred while opening the database. database disk image is malformed(code 11): , while compiling: SELECT * FROM sqlite_master WHERE type in('table','view') ORDER BY name"

Quote:
Originally Posted by  Theonew  View Post
No, I do not have a Prime (waiting for something else to come along  ). You could try pulling all files and placing them in a folder, then using an editor to see if that works.
Oh ha okay. I shoulda waited for the TF700t.. anyway thats what i have done, is pull all files and put them into a folder.. it doesn't seem to make a difference because the -shm and -wal make them unreadable to average editors as database files. I can zip them and link them to you if you think you can figure something out?

参考:http://forum.xda-developers.com/showthread.php?t=1710764&page=2

http://www.oschina.net/question/243960_80430

我把一个已经存在的数据库文件(例如:test.db)拷贝到/data/../应用包/下面,然后再调用api打开这个数据库文件SQLiteDatabase.openOrCreateDatabase(DB_PATH, null);有些机型没问题,有些机型会报错:android.database.sqlite.SQLiteDatabaseCorruptException: database disk image is malformed.

请问怎么调用直接打开已有数据库不会出错哈?谢谢

=== 使用sqlite3

   命令行工具下载:http://www.sqlite.org/download.html


sqlite3 data.db

opening-database-file-from-within-sqlite-command-line-shell

you can attach one and even more databases and work with it in the same way like using sqlite dbname.db

sqlite3 : sqlite> attach "mydb.sqlite" as db1;

and u can see all attached databases with .databases

where in normal way the main is used for the command-line db

.databases seq name file --- --------------- ---------------------------------------------------------- 0 main 1 temp 2 ttt c:\home\user\gg.ite 



你可能感兴趣的:(android sqllite database disk image is malformed)