Hello all,
In todays tutorial I will show you how to work with sqlite databases in android through command line.

1. You can browse any number of databases.
2. You can write any queries and execute.

First go through these tutorials to get a glance of how to work with sqlite databases in android.
1. http://coderzheaven.com/2011/04/sqlitemanager-plugin-for-eclipse/
2. http://coderzheaven.com/2011/04/using-sqlite-in-android-a-really-simple-example/
3. http://coderzheaven.com/2011/02/working-with-sqlite-database-in-android/

After going through these tutorials you will get to know these.
1. How to create an SQLite database.?
2. Where to locate the database file in your device or emulator?
3. How to browse the database using the plugin I provided in this example(http://coderzheaven.com/2011/04/sqlitemanager-plugin-for-eclipse/

I am using the sqlite database that I created using this example

Now open the command prompt or terminal and type

adb -s emulator-5554 shell

now type the path of your sqlite database like this.

sqlite3 /data/data/com.coderzheaven.pack/databases/mytest.db

check the screenshot for example

Now look at the screenshot for how am I navigating through the tables and selecting and inserting values to the table creating new tables etc.
Click and enlarge the image to see it.

You can exit the shell by typing ā€˜ ctrl+dā€™ twice.

This is the path of my database file

Which you can see by opening the file explorer from the window menu and expanding your package folder.(check this example for a screenshot of how to see the database http://coderzheaven.com/2012/01/how-to-save-score-in-android-cocos2d/)

Now about the SQLite database file.
Here I have three tables my_table, temp_table and test_table.
I am executing different commands to manipulate these tables.
The results are appearing just after the command

Please leave your valuable comments on this post.
Also +1 this post to share it to others if you liked it.



  1. razor December 2, 2012 at 2:32 pm

    I’ve installed plugin (eclipse4) but database icon is disabled.
    I can’t enter /data folder too
    i’m using Samsung Galaxy Nexus (android 4.2)

    • James December 4, 2012 at 5:11 am

      Check your database extension. Put it as a “.db” file.


Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.