views:

35

answers:

2

I'm testing an application I'm working on and I wanted to delete the database my application creates so I could read all the data from my web server back in to a fresh one.

I launched adb, went to data/data/my.applicaton.package/databases and did a "rm mydatabase". This deleted the database (note: I've done this many many times before without a problem).

I launched my application again and, to my surprise, a new database wasn't created. Even more surprising is there was data in my application. My application is still pulling the data from some where! It gets a Cursor from my database and uses a CursorAdapter to populate the list. So, it is obviously reading from a database (seemingly a cached one?).

Exactly where is it pulling from and why? It's pointed at a database that is now deleted.

+1  A: 

Are you sure you hadn't started the app, hit home/back to get to main screen, then did your adb magic? If you did that, then the program was still running in the background and the changes to the database were not picked up correctly. You should make sure to kill the running process in DDMS of your application before making changes to the database. Then launch the application and see if the changes are picked up.

I've run into this issue many times.

I82Much
Killing the process in DDMS fixed the issue. This is strange though. I've done this many times; seemingly without needing to kill the process in DDMS. Also, doing a ls in the data/data/my.application.package/databases did not show the database. So it must be copied somewhere while the application is using it?
Andrew
That's my guess. Would like to hear from someone more experienced to know for sure
I82Much
A: 

hello, i was wondering if you ever figured out where is the database stored when it is not running in the emulator? i am facing the same scenario as you are. thanks. HT

Henry
I killed the process in DDMS and it disappeared. Databases are normally in /data/data/your.application.package/databases
Andrew