Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sqlite3 permission denied android

Tags:

android

sqlite

I'm trying to access the database of the application I'm developping directly on my Nexus, but I get a "permission denied" when I tried to execute the "sqlite3" command. I also tried to start the adb in root mod, but again, permission denied on the device... I guess I will have to do that with the emulator but I have a lot of data to load and it would have been 10 times faster with the phone on Wifi than the emulator... Unless someone has any idea? thanks

like image 353
Sephy Avatar asked Jun 10 '10 09:06

Sephy


2 Answers

I struggled with this for a while, so here's my solution, which works on an unrooted device:

#!/bin/sh

# fill these values in
PACKAGE=com.example.android
DB=something.db 

# copy db to sdcard using package permission (using cat because no cp    command)
adb shell "run-as $PACKAGE cat /data/data/$PACKAGE/databases/$DB >   /sdcard/$DB"

# pull file from sd card
adb pull /sdcard/$DB

# do something with it (need to install sqlitebrowser obviously)
sqlitebrowser $DB
like image 152
eggbert Avatar answered Sep 22 '22 05:09

eggbert


The files are read protected, you need to root your phone or use the emulator.

like image 24
Alexander Stolz Avatar answered Sep 20 '22 05:09

Alexander Stolz