Examining sqlite3 Databases from a Remote Shell

From an adb remote shell, you can use the sqlite3 command-line program to manage SQLite databases created by Android applications. The sqlite3 tool includes many useful commands, such as .dump to print out the contents of a table and .schema to print the SQL CREATE statement for an existing table. The tool also gives you the ability to execute SQLite commands on the fly.

To use sqlite3, enter a remote shell on the emulator instance, as described above, then invoke the tool using the sqlite3 command. Optionally, when invoking sqlite3 you can specify the full path to the database you want to explore. Emulator/device instances store SQLite3 databases in the folder

/data/data/<package_name>/databases/.

Here's an example:

$ adb -s emulator-555 4 shell

# sqlite3 /data/data/com.example.google.rss.rssexample/databases/rssitems.db

SQLite version 3.3.12

Enter ".help" for instructions

enter commands, then quit...

sqlite> .exit

Once you've invoked sqlite3, you can issue sqlite3 commands in the shell. To exit and return to the adb remote shell, use exit or ctrl+d.

0 0

Post a comment