Search code examples
androidsqliteadb

How to install or get access to sqlite3 from adb shell


I need a way to install or somehow get access to sqlite3 in the adb shell. I have rooted my device.

I've tried to find an answer but the closed I could come is: Why do I get a "sqlite3: not found" error on a rooted Nexus One when I try to open a database using the adb shell?

But I don't think it's good idea to push my windows sqlite3.exe on a linux system?

So is it possible to install the sqlite3 terminal browser somehow?

[SOLUTION]

From the different comments and some asking around at #android-dev (irc), I found a solution. First I copied the database file to my desktop. But fist I had to install BusyBox, because cp isn't included?!? After that ran I into the problem that I couldn't pull or push from anywhere but /sdcard/ . I could then use /sdcard/ as a "middle station" and pull/push my db.

Then I got exhausted! I really had to have my sqlite terminal explore. Then I got the idea to start the emulator pull the sqlite binary from /system/xbin/sqlite3. Then remount /system with rw:

# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system

and push sqlite to the /sdcard/, and from there copy it to /system/xbin/

Now it works :D


Solution

  • I use Rajath's technique... Adb "Pull" the db from the emulator/device, work on it, then adb "push" it back onto/into the emulator device.

    also: I use the free SQLite Editor from the Android Market. I have not rooted my LG Ally and therefor can only edit database tables on my sdcard with SQLite Editor.

    Rajath suggests using the adb to push and pull the databases to and from the emulator/device. The work on the database with the windows (or whatever) sqlite3 program you have. He does not suggest pusing the windows sqlite3 onto the Android device, IMHO.

    I note that java/android "query()" sends actual SQL commands programmacitacly to ones program with user input. I conclude that sqlite3 is in Android somewhere.

    When using the emulator Dev Tools is available, and way down at the bottom of the list is the Terminal Emulator. This allows exploration of file structure of Android in the emulator. However using "adb shell" from the PC has root permissions.

    good luck. cactus mitch