I am getting an error while connecting to Sqlite DB in android through command prompt.
Here are the steps I have followed:
D:\adt-bundle-windows-x86-20131030\adt-bundle-windows-x86-20131030\sdk\platform-tools> adb shell
root@generic:/ # sqlite3 /data/data/package-name/databases/SampleDB.db
SQLite version 3.7.11 2012-03-20 11:35:50
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
SQL Error: unable to open database "/data/data/com.congnizant.encryptdata/databases/SampleDB.db": unable to open database file
Permision for SampleDB is '-rw-rw----';
It looks like my very same problem not long ago.
You may test something first. Once you're connected to the device with
adb shell, try
ls data/data/<application_namespace_id>/databases/. If it returns
opendir failed, Permission denied, it should be the same problem I had: ADB permissions issue. And here's what solved my problem:
Now, try again your commands. But once you enter
adb shell also enter
su to enable Super User mode. You should see a
# confirming your shell on Super User mode.
If you have only one device connected, it should work now. Otherwise, you should also confirm if you're connected to the right device by listing your devices first running
adb devices and connecting to right one
adb -d <device_reference_here> shell.
You'll probably also need your phone rooted to do any of this.
Hope it helps. Cheers!