Swifty McSwifterton
Swifty McSwifterton

Reputation: 2667

Android SQLite path

I am working with SQLite in an App. It writes to the database, etc., with no problem. However, I can not find this new database. I have tried changing the directory with cd /data/data/packageName/databases, but it says "no such file or directory". Also, this database is not found when I click on the File Explorer in eclipse. My logging tells me the database was created and that it is being written to. I think I need to set the path in the shell or something to that effect using adb, but I have no idea how to do that. Can anyone give me some instruction? Also, I am using my phone for development. The database also does not show up when using the emulator.

Thanks very much. Matt

Upvotes: 0

Views: 1490

Answers (2)

walta
walta

Reputation: 3466

Matt,

This thread gives a good explanation on why you might not be able to access the data folder on your phone.

Can't access data folder in the File Explorer of DDMS using a Nexus One!

You can still test the Sqlite code though. Just boot up an emulator. The emulator will have no access restrictions. Once it's booted up you can use the ddms tool (located in the tools directory under your android SDK install folder). It has a File Explorer and you can download the files from the /data folder.

Upvotes: 1

CommonsWare
CommonsWare

Reputation: 1006614

Also, I am using my phone for development.

You cannot access the database on a standard Android device except via your own application code.

Your options are:

  1. Do this sort of testing on an emulator, in which case you can access the directory that you are failing to access on the device
  2. Add a database backup feature to your app, that copies the (closed) database to external storage, so you can examine it
  3. Root your phone (leastways, I am under the impression this can help get you to this directory -- haven't done it myself)

The database also does not show up when using the emulator.

Try harder. If you can store data in the database and read data out of it using SQLiteDatabase, then the database file is there.

Upvotes: 1

Related Questions