2

I am implementing the data base using sqlite in android .I create table and insert value successfully .I also retrieve value. But my problem is that how to get file of DB from DDMS .Actually I saw a developer who take file from DDMS or somewhere else(I don't know) open it and saw all values in that?

Can you please tell me how to get that file .so that I will look it.

Let me explain again.I need sqlite (in which i create table) so that i will check entry ?

5 Answers5

1

you can see it in DBMS->file explorer->data->data->your package

zohreh
  • 1,055
  • 1
  • 9
  • 26
  • can we check on emulator..? –  Oct 19 '13 at 03:53
  • I am not getting option of data in emulator when I go to file explorer –  Oct 19 '13 at 03:54
  • yes this work in emulator.befor you go to file explorer part you should select your emulator in devices part of DBMS then you have folder data in file explorer – zohreh Oct 19 '13 at 03:57
  • you can't check your db on emulator you only can check it in dbms as I say – zohreh Oct 19 '13 at 04:00
  • I got the file .Now hoe to check my package .there is lot of package –  Oct 19 '13 at 04:02
  • in project I take this package com.example.database_example; –  Oct 19 '13 at 04:03
  • ok go to it packade in folder data and then in that package have a folder called as databases or other thing that your db is in it with extension .db – zohreh Oct 19 '13 at 04:05
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/39538/discussion-between-user944513-and-linux) –  Oct 19 '13 at 04:06
1

check Sqlite Manager Plugin for eclipse.

SQLiteManager plugin for eclipse

Not able to open database file in SQLite manager plugin for eclipse?

Community
  • 1
  • 1
Ram kiran Pachigolla
  • 20,897
  • 15
  • 57
  • 78
0

Do yout want get DB file from internal memory of android device ( samsung, sony...)? if your device is not rooted, that is impossible .

0

There are two scenarios: rooted or non-rooted.

If rooted, you can just do the following using command line:

adb shell
su
cd /data/data/com.your.company/databases/
cp your.sqlite /sdcard

Then it is in your sdcard, you can do adb pull /scard/your.sqlite

But it is too cumbersome, so what you really should do is, in your java code:

new File(database.getPath()).setReadable(true, false);

The database is your SQLiteDatabase instance, probably in the SQLiteHelper class. Then you can simply:

adb pull /data/data/com.your.company.package/databases/your.sqlite
Shawn
  • 1,598
  • 1
  • 12
  • 19
0

You can always use ADB to solve your problem.
If you are a developer of the same app use this commmand to push and pull to get the database and see in
adb shell
run-as com.example.yourapp
cd /data/data/com.example.yourapp/databases
chmod 666 ./com.example.yourapp.db
OR
you can do a ls -l to see the name and permissions of your database
pull com.example.yourapp.db C:\Where_you_want_the_database
OR
pull ./com.example.yourapp.db C:\Where_you_want_the_database
you can edit the database using SQLlite browser and you can also push the database like this
push C:\your_database.db /data/data/com.example.yourapp/databases

This works well even without rooting the device and also in emulators and on real devices.

johntheripp3r
  • 989
  • 6
  • 15