-1

I am trying to read my database file mydatabase.db from real android device but after entering inside all directories when i tried to open my database file i get error everytime that file not found. Please suggest good solution. Thanks in advance.

DATABASE PACKAGE NAME = com.example.databasedemo DATABASE FILE NAME=mydatabase.db

G:>cd adt-bundle-windows-64\adt-bundle-windows-x86_64-20140702\sdk\platform-too ls

G:\adt-bundle-windows-64\adt-bundle-windows-x86_64-20140702\sdk\platform-tools>a
db -d shell
shell@ks01lte:/ $ cd data/data
cd data/data
shell@ks01lte:/data/data $ cd com.example.databasedemo
cd com.example.databasedemo
shell@ks01lte:/data/data/com.example.databasedemo $ cd databases
cd databases
shell@ks01lte:/data/data/com.example.databasedemo/databases $ ls
ls
opendir failed, Permission denied
255|shell@ks01lte:/data/data/com.example.databasedemo/databases $
  • Maybe you could tell us what you are doing – Rob Nov 29 '14 at 23:32
  • If you are trying to access db in `system/data/app` - its not possible – Toumash Nov 29 '14 at 23:32
  • G:\>cd adt-bundle-windows-64\adt-bundle-windows-x86_64-20140702\sdk\platform-too ls G:\adt-bundle-windows-64\adt-bundle-windows-x86_64-20140702\sdk\platform-tools>a db -d shell shell@ks01lte:/ $ cd data/data cd data/data shell@ks01lte:/data/data $ cd com.example.databasedemo cd com.example.databasedemo shell@ks01lte:/data/data/com.example.databasedemo $ cd databases cd databases shell@ks01lte:/data/data/com.example.databasedemo/databases $ ls ls opendir failed, Permission denied 255|shell@ks01lte:/data/data/com.example.databasedemo/databases $ – user1808596 Nov 30 '14 at 01:47

1 Answers1

1

It's possible via adb:

adb -d shell 'run-as com.your.package cat /data/data/com.your.package/databases/dbname.sqlite > /sdcard/dbname.sqlite'
adb pull /mnt/sdcard/dbname.sqlite
Petr Duchek
  • 1,223
  • 14
  • 19
  • hi Petr, Thanks for that but could its not working.. should i use commas as well ('') and what is use of cat ? .. Thanks – user1808596 Nov 30 '14 at 01:51
  • One non-rooted android device you can navigate to the data folder (containing the database) only using the run-as command with your package name. So you have to copy database file to sdcard (cat command ) and then you can read sdcard via mass storage or use adb pull for get your database. – Petr Duchek Nov 30 '14 at 02:08
  • Microsoft Windows [Version 6.2.9200] (c) 2012 Microsoft Corporation. All rights reserved. C:\Users\Deepinder>g: G:\>cd adt-bundle-windows-64\adt-bundle-windows-x86_64-20140702\sdk\platform-too ls G:\adt-bundle-windows-64\adt-bundle-windows-x86_64-20140702\sdk\platform-tools>a db -d shell 'run-as com.example.databasedemo cat /data/data/com.example.database demo/databases/mydatabase.sqlite > /sdcard/mydatabse.sqlite' The system cannot find the path specified. – user1808596 Nov 30 '14 at 02:14
  • Thanks Petr, But still getting error. I am doing any mistable – user1808596 Nov 30 '14 at 02:15
  • try mydatabase.db .. maybe you can try alternative way: http://stackoverflow.com/a/18472135/3080479 – Petr Duchek Nov 30 '14 at 02:19