Igor
Igor

Reputation: 6255

View SQLite DB on Android device

ALL,

I have an Eclipse Kepler where I am developing my Android application. This application uses SQLite for data persistence.

What I'd like to do is to see the database/tables/data inside Eclipse.Following this I opened installed the plugin, then opened File Explorer.

Problem is: trying to open /data is unsuccessful. It does not open.

Do I have to root the device to open this directory? I have LG phone with Android 2.2.

Permission sets for this folder is drwxrwx--x.

Thank you.

[EDIT]

I also tried to run the shell

igor@IgorReinCloud ~ $ android_sdk/platform-tools/adb -d shell
$ sqlite3 /data/data/com.radar.radar/databases/friends.db
sqlite3: permission denied
$ 

So it actually means that this is a permission issue and therefor I will not be able to see the db.

[/EDIT]

Upvotes: 1

Views: 537

Answers (2)

sanath_p
sanath_p

Reputation: 2218

Using this simple library you can directly view your SQLlite datbase from your app . no need to extra .db file 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

Upvotes: 0

Karakuri
Karakuri

Reputation: 38585

you can try

$ adb -d shell
$ run-as [your-package-name]

This should allow you to run commands as the user for that package. No guarantees though. Also, I've found that not all devices appear to have sqlite3 available through the shell.

Another possibility is to do the run-as command as above, then copy the database file to /sdcard, whcih is public. Then you can do adb pull /sdcard/[database-file]. Then you'll have the file on your local machine and can use sqlite3 there.

Upvotes: 1

Related Questions