tags:

views:

2895

answers:

4

Hi folks,

I'm working on an Android application that stores data in a SQLite database. My question is, where does this database file get stored on the filesystem when you're using an emulator?

I have seen that it's stored in

/data/data/package_name/databases

but I need to know where on my local machine's hard drive that actually maps to. The database persists on multiple runs of the emulator, even after having shut down the machine, so it can't just reside in RAM...

+12  A: 

The filesystem of the emulator doesn't map to a directory on your hard drive. The emulator's disk image is stored as an image file, which you can manage through either Eclipse (look for the G1-looking icon in the toolbar), or through the emulator binary itself (run "emulator -help" for a description of options).

You're best off using adb from the command line to jack into a running emulator. If you can get the specific directory and filename, you can do an "adb pull" to get the database file off of the emulator and onto your regular hard drive (this applies to a real device too, even if you have non-root permissions and "ls" isn't showing you anything).

Klondike
I got the DB off via ddms from Eclipse. Made my changes, then pushed back. Worked like a charm.
I82Much
+1  A: 

You have to be on the DDMS perspective on your Eclipse IDE (Windows > Open Perspective > Other > DDMS), and, the most important, YOUR APPLICATION MUST BE RUNNING SO YOU CAN SEE THE HIERARCHY OF FOLDERS AND FILES. Then you will follow the path data > data > your-package-name > databases > your-database-file.

Check out this link, it explains everything, its on portuguese, but you can translate it on google translator.

http://www.psyhclo.com/?p=89

psyhclo
A: 

you can pull /data/data/package_name/databases/databasefile.db from device to your harddisk using DDMS. Then you can use SQLite3 to open and work on that databasefile.db

You can use any Graphic SQLite management tool to work with the databasefile.db on your PC. Create tables, insert, update, delete... After you have done just upload the databasefile.db to device using DDMS again.

If you are interested in developing GPS and routing service for android phones, check our website www.andgps.com

Thanks but already got an answer. I don't appreciate the unsolicited advertisement, however.
I82Much
+1  A: 

The databases are stored as SQLite files in /data/data/PACKAGE/databases/DATABASEFILE where:

You can see (copy from/to filesystem) the database file in the emulator selecting DDMS perspective, in the File Explorer tab.

caligari