Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 385
DNRN Avatar asked Mar 30 '11 11:03

DNRN


People also ask

How do I install sqlite3?

First, go to SQLite's official website download page and download precompiled binaries from Windows section. Once the download is completed, you should see the downloaded file in the Windows Downloads directory. Next, right click on the downloaded file and extract it inside the C:\sqlite directory.

Where do I put sqlite3 DLL?

Where do I put SQLite DLL? The SQLite DLL file can be placed on Windows in C:WINDOWSsystem32 folder if needed to manage your database files.


2 Answers

Download this app from google play will help you install sqlite3 on android https://play.google.com/store/apps/details?id=ptSoft.util.sqlite3forroot

like image 121
ax003d Avatar answered Sep 28 '22 18:09

ax003d


You don't need root to pull the database from your device. Simply run the following commands:

adb shell run-as <package-name> "cp databases/<db_name>.db /sdcard/ && exit"
adb pull /sdcard/<db_name>.db ~/Downloads/

From there, you can use sqlite3 for whatever operating system you're using (http://www.sqlite.org/download.html), or a sqlite browser such as "DB Browser for SQLite" (http://sqlitebrowser.org/)

like image 27
Chris Avatar answered Sep 28 '22 18:09

Chris