Inlägg från — augusti 2010

Dumping an Android SQLite database

Today I was having a problem trying to dump an Android SQLite database located on the phone. When I connected to the phone’s shell through ADB it couldn’t find the sqlite3 binary for some reason. Couldn’t really find a decent online resource for this so I thought I would write it down here in case someone else has the same problem.

First off you have to have the Android SDK installed on your computer and have your phone connected via USB. In my case I first had to root my phone, I won’t cover this process in this guide, this is something you’ll have to find elsewhere. 2nd of all you need to locate the database file which you want to dump, it usually is /data/data/<package name>/databases/<database name>.  Open up a command prompt and go to the tools directory if your computer. Type “adb pull /path/to/database”, this will get the database file and put it in your tools directory. Next, type “sqlite3 <database filename>”. This will open up your sqlite3 shell locally. Next, type “.output database.sql”, this will write your dump to a file called database.sql, instead of just dumping it on screen. Finally, type “.dump <table name>”, this will dump the table you specify.  To list your tables, just type “.tables” and it will list your tables.

Happy dumping!

20 augusti 2010   Inga kommentarer