0
votes

In the developer docs, it's mentioned that sqlite3 is available via the adb shell. However, when I do this, the database I am looking at appears completely empty, whereas when I adb pull the .sqlite file and examine it locally, it contains what it should. For example, in the latter case .tables lists the tables, in the former case it lists nothing, and attempts to select from the tables that should exist return "Error: no such table". Etc.

There is no permissions issue -- sqlite3 starts without complaint, I am apparently root and the permissions are 660.

1
How exactly are you running sqlite3 with the adb shell? - CL.
@CL According to this official-but-casual description, the adb shell is a unix-y remote shell, hence can accesses binaries in the device's /system/bin. However, in the case of sqlite3 I'm guessing it's using a local version on the remote file, since A) I don't see sqlite3 in the device's /system/bin, and B) the android SDK includes a copy of sqlite3 in the tools/ directory. - CodeClown42
What exactly are you typing to run sqlite3? - CL.
@CL Sorry, lol, my eyes read that as "Why exactly are you trying to run sqlite3?" yesterday. And thanks, because that lead to my problem, of course: sqlite3 creates a file if the path doesn't exist. I must have been one level up (/data/data/[app]/ instead of /data/data/[app]/databases) when I first went in and subsequently kept taking that for what I was looking for...facepalm. - CodeClown42

1 Answers

1
votes

In fear that someone may someday make the same stupid mistake: beware that if the filepath you use with sqlite3 does not exist, it will be created on the presumption that you are making a new database.

Evidently I logged in, cd'd to /data/data/[app] -- which I could see in the android device monitor's "File Explorer" contained database/[app].sqlite -- forgot to cd database and did not bother to ls because I was (sort of subconsciously) presuming sqlite3 would give a "File not found" error if it wasn't there. This creates an empty [app].sqlite file which is what I subsequently kept finding nothing in.