Android: Where are the database files stored?

I created a SQLite database on an Android device. The program can read / write to the database, so the database file was obviously created. SQLiteDatabase.mPath is set to

db.mPath = "/data/data/dev.client.android/databases/clientDB.db" 

but when I browse the directories on the device, I can not find the clientDB.db file. I looked into the data directory, but it seems empty.

Does anyone know what could be wrong here?

+43
android database sqlite
Jul 09 '09 at 17:05
source share
3 answers

If you mean that you visited /data and didn’t find anything in it, and you are exploring the usual piece of Android equipment, which is expected. DDMS does not have permission to view /data .

However, at least if your application is compiled in debug mode, you can use the adb pull command on the console to download the file directly.

+28
Jul 09 '09 at 21:29
source share

try getDatabasePath on ContextWrapper ( http://developer.android.com/reference/android/content/ContextWrapper.html ). If you are in an Activity or Application class, try:

 File dbFile = getDatabasePath(MY_DB_NAME); Log.i(dbFile.getAbsolutePath()); 

Just assuming that its value in /data/data/my.package.name/databases/ bad, because there is no guarantee that the data was not moved to the SD card, or the device / OS just decided in another data directory.

+31
Apr 20 2018-11-11T00:
source share

In debug mode, you can use adb shell and view the contents of the directory. In the shell, you can call sqlite3 / data / data / dev.client.android / databases / clientDB.db to analyze the database.

+6
Jul 28 '09 at 8:54
source share



All Articles