Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

adb

 
chetan dhumane
Ranch Hand
Posts: 641
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,

How to use adb to access databases created by application
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Linking to Android Debug Bridge documentation for those who don't know what adb is.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne, I thought this was spam and I was going to delete it.
 
Michael Rivera
Ranch Hand
Posts: 132
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you mean accessing SQLite3? you can from ADB , just add the : Android Home/tools to your environment variables and then bash on (Emulator must be running)
 
chetan dhumane
Ranch Hand
Posts: 641
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please explain me that procedure int detail.
Or if you have any link for that procedure do provide me .

I have tried

$ adb -s emulator-5554 shell
# sqlite3 /data/data/com.example.google.rss.rssexample/databases/rssitems.db
SQLite version 3.3.12
Enter ".help" for instructions
.... enter commands, then quit...


but i can't access the database which my application has created , how to identify the .db file that my application has created.

Thanks
 
Mark L. Murphy
Author
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to identify the .db file that my application has created


Well, you are looking in the right place, assuming your application's package is com.example.google.rss.rssexample.

Just do an ls of /data/data/com.example.google.rss.rssexample/databases to see what is in there.

Note that this will work on an emulator but may not work on a device due to security restrictions.
 
sharon daze
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
chetan dhumane
Ranch Hand
Posts: 641
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

even i select a proper .db file it shows me error no such table
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...how to identify the .db file that my application has created.


In your application, when you create a database you give it a name. Generally, you give it <somename.db>. This file is stored under : data/data/<your app package(for e.g. com.database.access)>/databases folder. CD to this folder and then type: sqlite3 <your database name>.

Type .tables to actually see all the tables that you have created.

even i select a proper .db file it shows me error no such table


Are you typing the commands correctly(it is case sensitive)? Are you trying this on the emulator? As Mark said, this works only on the emulator.
 
chetan dhumane
Ranch Hand
Posts: 641
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Eclipse for exploring which application uses which db , from there i have correctly identified .db file of my application.

and then i am using command prompt to explore the .db file located into the emulator.

is this way correct ?

It gets connected properly to .db file but then shows table not found.

I am able to insert entries into the database from my application.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic