sqlite command in adb

February 26, 2009 at 9:34 am | Posted in android | 3 Comments
Tags: ,

Connect to a database:

adb shell

# sqlite3 data/data/com.google.android.providers.contacts/databases/contacts.db

sqlite3 data/data/com.google.android.providers.contacts/databases/contacts.db

SQLite version 3.5.0

Enter “.help” for instructions

List tables:

.table

Print some of the information from the tables:

.header on

.mode column

sqlite> .header on

.header on

sqlite> .mode column

.mode column

sqlite> select * from phones;

select * from phones;

_id         person      type        number        number_key    label

———-  ———-  ———-  ————  ————  ———-

1           1           1           +15085551212  21215558051+

2           1           0           +17815551212  21215551871+

3           1           2           +16175551212  21215557161+

.help can tell you more useful command.

LIKE Operator Example
SELECT * FROM Persons WHERE City LIKE ‘s%’;

3 Comments

TrackBack URI

  1. it is worth noting that this only works on the emulators and NOT actual handsets. the adb shell command is rather limited due to security constraints on the actual handsets.

    • You are absolutely right. It can help us to develop application.

  2. hi !
    it is nice, please tell me all commands to communicate with sqlite database. I am new to this database.
    thanks in advance.


Sorry, the comment form is closed at this time.

Blog at WordPress.com.
Entries and comments feeds.