user1183460
user1183460

Reputation: 1

Getting SQLite database from emulator (data/data/package_name/databases) to local drive

I would like to edit my app's DB using the SQLite Browser. I'm able to edit the DB using the adb shell (sqlite3), but I would rather edit it using a GUI rather than a command line. How do I get the DB from the emulator to a local drive? As of now I've tried:

1) using the adb pull command to pull the database from the emulator to my local drive.

adb pull data/data/com.myapps.quiz c:/

This command executes correctly, but I'm not able to find the file or directory in the local drive I specified.

2) Used the DDMS Perspective to locate the file in the File Explorer, but every time I get into the data/data directory, I only see directories called "con". I even tried pulling the entire data/data directory, but I can't find the name of the package (com.myapps.quiz) where the database is stored.

What am I missing here? Any help you could provide would be most helpful!

Upvotes: 0

Views: 3242

Answers (2)

Vivek Khandelwal
Vivek Khandelwal

Reputation: 7849

Your database is secure to your package so you cannot get this directly.

I have a work around for this.

What I do is go to shell and run-as my package and copy the database to sdcard using cat

adb shell
run-as your.package.name
cd databases
cat your_database.db > /mnt/sdcard/your_database.db

And I pull the file from the sdcard using File Explorer

Upvotes: 1

Stev_k
Stev_k

Reputation: 2126

Are you sure you're connecting to the emulator instance in DDMS, and not an actual device? I have always been able to push and pull sqlite databases from the

 data/data/com.my.package/databases/mydb.sqlite

directory, and I can't think of any setting that would override that. An alternative would be to root an actual phone and then you will be able to move anything from the phone to your computer.

Upvotes: 0

Related Questions