# SQLite database operation from Android terminal

I want to do SQLite command like sqlite3 myDb.db, or do other SQLite command from Android shell, like Terminal Emulator or something else.

I have tried googling for these, but no luck. Is it possible to do that? If it is, how to do it?

I'm using locally-made Android phone in my country, based on Jelly Bean OS.

• Closely related: android.stackexchange.com/questions/5053/… – Andrew T. Sep 3 '15 at 5:42
• @Andrew T, you refference me? the other question maybe look like same with me. but I'm not developed, I am pure user work in android not in PC. can you give me other refference? – ian cikal Sep 3 '15 at 6:01
• Since you mentioned Android shell, some of answers from there should work. The main problem is, most of Android devices don't have sqlite3 binary installed. That's why you can't call sqlite3 myDb.db from Android. If sqlite3 binary for Android is installed correctly on the device, then there should be no problem. Refer to SQLite binary on XDA forum – Andrew T. Sep 3 '15 at 6:14
• great, why these answers not in mind.. anyway thanks for answering my question.. – ian cikal Sep 3 '15 at 6:17

Yes, it's possible if you have sqlite3 binary for Android installed. Most of Android devices don't have this binary. If your device doesn't have it, then you need to get the proper binary and install it (refer to Where can I obtain an SQLite 3 command line binary for Android?). Note that you need root access to do this.
After getting the sqlite3 binary, place it inside system/bin/ (or system/xbin/). After this, you just need to test if the terminal can access the binary by calling sqlite3 from there. If it shows sqlite> prompt and SQLite version, then you're done.
For usage hints, on sqlite3, write .help.
sqlite> .help