Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy sqlite database from device to PC

I have an android program that stores its information in a sqlite database. Will it be straighforward to copy that db file to a pc once the device is plugged via USB or should a special functionality be written in the program itself to dump the db contents to a file under the /sdcard directory ?

Thanks

like image 298
xain Avatar asked May 16 '11 00:05

xain


People also ask

Can I copy SQLite database?

You can use the SQLite . clone dot command to create a clone of the current database.


2 Answers

You can use the adb pull command to read a file from the teathered device to your desktop, e.g. adb pull /data/data/com.foo.bar/databases/MyDatabase

like image 179
superfell Avatar answered Sep 28 '22 01:09

superfell


You can create a bat file and run it , it will create a folder name clonedb and pull all database to this

adb shell rm -rf /sdcard/clonedb
adb shell run-as <app package> cp -r /data/data/<app package>/databases/. /sdcard/clonedb
adb pull /sdcard/clonedb ./
like image 28
vuhoanghiep1993 Avatar answered Sep 27 '22 23:09

vuhoanghiep1993