最近遇到类似下面的问题,
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"
Originally Posted by
Theonew
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.
|
参考: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