Note You will see two additional databases in release 15 user dictdb and launcherdb

Unlike traditional databases on servers and desktops, SQLite databases on the device are created as needed. You might not see some database files unless you have accessed the database at least once, thereby instigating its creation. You can invoke sqlite3 on one of these databases inside the adb shell by typing this:

#sqlite3 /data/data/

You can exit sqlite3 by typing this: sqlite>.exit

Notice that the prompt for adb is # and the prompt for sqlite3 is sqlite>. You can read about the various sqlite3 commands by visiting However, we will list a few important commands here so that you don't have to make a trip to the web. You can see a list of tables by typing sqlite> .tables

This command is a shortcut for

SELECT name FROM sqlite_master

WHERE type IN ('table'/view') AND name NOT LIKE 'sqlite_%' UNION ALL

SELECT name FROM sqlite_temp_master WHERE type IN ('table'/view') ORDER BY 1

As you probably guessed, the table sqlite_master is a master table that keeps track of tables and views in the database. The following command line prints out a create statement for a table called people in contacts.db:

.schema people

This is one way to get at the column names of a table in SQLite. This will also print out the column data types. While working with content providers, you should note these column types because access methods depend on them.

However, it is pretty tedious to humanly parse through this long create statement just to learn the column names and their types. Luckily, there is a workaround: you can pull contacts. db down to your local box and then examine the database using any number of GUI tools for SQLite version 3. You can issue the following command from your OS command prompt to pull down the contacts.db file:

adb pull /data/data/ * c:/somelocaldir/contacts.db

We used a free download of Sqliteman (, a GUI tool for SQLite databases, which seemed to work fine. We experienced a few crashes but otherwise found the tool completely usable for exploring Android SQLite databases.

0 0

Post a comment