2

i can access the my sqlite db using adb shell commands in my emulator. But can not do the same for my HTC Desire phone. it throws some permission denied messages. is there any possible to access those database for debugging purpose. Any Idea?

Thanks in Advance.

8
  • Where is the database? In /data/data? If the phone is not rooted, you don't have access. You'll need to have your app copy it to the sdcard first, in that case. Commented Dec 17, 2010 at 5:45
  • Where is your database stored? If its stored on SDCard, then you need to use the permission android.permission-group.STORAGE" in manifest. Commented Dec 17, 2010 at 5:46
  • @EboMike : Okay then How can i copy the app from phone? Commented Dec 17, 2010 at 5:59
  • @Mudassir: I have stored my database into my app itself Commented Dec 17, 2010 at 6:00
  • If you have stored the db on the internal storage, then it should be easily accessible. You should check your db logic from start. Commented Dec 17, 2010 at 6:07

3 Answers 3

5

You can also type the following in to the command prompt/terminal

If your app package was com.example.dbtest and the database was called sqlite.db

adb shell

run-as com.example.dbtest

cat databases/sqlite.db > /sdcard/sqlite.db

exit

exit

adb pull /sdcard/sqlite.db /path/to/place/file

(if you leave the last parameter blank, it will be placed in the same directory as adb)

This does not require root and be scripted to remove any file from your apps.

You could also use a stream reader and writer to copy it to the sdcard. Do not copy it row by row as barmaley suggested as this may mask errors.

Sign up to request clarification or add additional context in comments.

1 Comment

This answer should be on the top! +1 :)
3

I can see only 2 options:

  1. Get root access to your device
  2. Write special procedure, which will copy your database to SD card (just record by record using SQLite API)

4 Comments

Please elaborate your answer. how to get the root acces of my phone.
Every phone is different. Google "root" for your phone model. CyanogenMod for examples is a popular rooted ROM that works on several popular phones.
Please give me the steps to follow or guidelines to root my phone?
Let me write it again. Every phone is different. There are different step for every phone. Depending on the phone you have, you need to take different steps. There are no generic steps that work on any phone. It depends on your phone. Please use Google to search for the steps that pertain to your particular phone. Enter the name of your phone model, and "root", and you are likely to find the steps that work for your particular phone.
0

you dont need to rootor export you db . you can manage you android database directly from your apps using the below library

https://github.com/sanathp/DatabaseManager_For_Android

Its a single java activity file ,just add the java file to your source folder you can view the tables in your app database , update ,delete, insert rows to you table .Everything from your app.

When the development is done remove the java file from your src folder thats it .

It helped me a lot .Hope it helps you too .

You can view the 1 minute demo here : http://youtu.be/P5vpaGoBlBY

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.