Reputation:
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 ?
Upvotes: 2
Views: 747
Reputation: 989
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.
Upvotes: 0
Reputation: 21191
check Sqlite Manager Plugin for eclipse.
SQLiteManager plugin for eclipse
Not able to open database file in SQLite manager plugin for eclipse?
Upvotes: 1
Reputation: 1593
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
Upvotes: 0
Reputation: 41
Do yout want get DB file from internal memory of android device ( samsung, sony...)? if your device is not rooted, that is impossible .
Upvotes: 0