25

I am trying to reach the sqlite database on my device using the procedure described here: How can i see SQLite Database (No emulator)?

However, I keep on getting sqlite3 not found. I assume I am meant to be entering the commands with the hash (#) sign at the start of the line. I tried with it and got nothing. Without it I get the error message.

The sqlite3.exe file is definitely there and in the path.

Do I have to install something?

Community
  • 1
  • 1
theblitz
  • 6,683
  • 16
  • 60
  • 114
  • http://stackoverflow.com/questions/3645319/why-do-i-get-a-sqlite3-not-found-error-on-a-rooted-nexus-one-when-i-try-to-op The second answer on this page has worked for me – Joe Oct 24 '11 at 15:24

3 Answers3

36

Some manufacturers deliver the devices without sqlite being installed on them. You can copy the sqlite program though from a emulator to your device if the device has an arm processor.

  1. Start the emulator and use the adb command from the platform-tools in android-sdk

    adb pull /system/xbin/sqlite3

  2. Mount the system partition of your device read/write after this tutorial:

    http://android-tricks.blogspot.com/2009/01/mount-filesystem-read-write.html

  3. Use the adb command to copy the sqlite3 file to your device

    adb push sqlite3 /system/xbin/

After you reboot your device the sqlite3 command should work.

Edit (copy from linked page - in the case link becomes invalid). The instructions for step 2 are:

adb shell
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

"Replace /dev/block/mtdblock3 & /system with appropriate device path and mount point, as obtained from cat /proc/mounts"

User
  • 31,811
  • 40
  • 131
  • 232
Dyonisos
  • 3,541
  • 2
  • 22
  • 25
  • Tried this but the pull command fails because it can't find the sqlite3 file. It's not in xbin. Where can I find it? – theblitz Oct 25 '11 at 07:24
  • please make sure, that the physical device is **not** connected and your emulator is running when executing the adb pull! – Dyonisos Oct 25 '11 at 07:56
  • 1
    I'm still doing something wrong. I did cat /proc/mounts and from the line "/dev/block/stl9 /system" I took the values. I then entered "mount -o remount,rw -t yaffs2 /dev/block/st19 /system". How do I now copy? I tried from within the adb shell but it won't accept he command. When I exit the shell and then enter the command it claims it is read-only. – theblitz Oct 25 '11 at 12:07
  • Maybe you could copy the `sqlite3` file to the sd-card first with the push command. Afterwards you go to the `adb shell`, enter `su` and then something like: `mv /mnt/sdcard/sqlite3 /system/xbin` – Dyonisos Oct 25 '11 at 12:18
  • 1
    Ok. So I maanaged to push to /mnt/sdcard. Now when I eneter adb shell and try "su" it doesn't recognise the command. – theblitz Oct 25 '11 at 12:39
  • This only works if your phone is rooted, You can try though to mount your `/system` partition read/write but I guess you have no write permission on the /system/xbin folder without root. If you want to root your phone you will find several tutorials in google. Otherwise you can call the `sqlite3`command also directly from the sd-card. Just do (in the adb shell) `cd /mnt/sdcard`, `chmod +x sqlite3` and then you can call the program always with the absolute path `/mnt/sdcard/sqlite3` – Dyonisos Oct 25 '11 at 12:51
  • I'd rather not root my tablet and phone if I can avoid it so I will go down the second path and go directly via the sdcard. Many thanks. – theblitz Oct 25 '11 at 13:01
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/4525/discussion-between-theblitz-and-dyonisos) – theblitz Oct 26 '11 at 08:19
  • sentence: `After you reboot your device the sqlite3 command should work` is very important clue – ceph3us May 26 '15 at 02:55
  • Thanks for that, @hBrent. I tried `cat /proc/mounts` but it spit out a bunch of stuff I didn't understand. Using Luke's comment from that answer you linked did the trick, though. – Chris Apr 08 '18 at 07:52
  • Also, instead of getting sqlite from an emulator, I had Titanium Backup installed, which has it. So I just did `cp /data/data/com.keramidas.TitaniumBackup/files/sqlite3 /system/xbin/` to copy it over – Chris Apr 08 '18 at 07:56
7
  1. Go to Play store --> search for Titanium Backup & install it
  2. adb shell
  3. su
  4. cp /data/data/com.keramidas.TitaniumBackup/files/sqlite3 /system/xbin/
  5. cd /system/xbin/
  6. chmod 755 sqlite3
  7. adbd reboot (just in case)
  8. Enjoy the result
Ender
  • 835
  • 1
  • 12
  • 23
0

For those who, like me, couldn't use Sqlite3, I used a workaround for this:

cat srcfile> / mnt / sdcard / dstfile

With this you can put the files into an external .db manager.