Android SQLite External Query Tool - android

Is there a way to connect to the SQLite database while the emulator is running and do manual queries against the database?
The following is a basic sequence of steps I'm looking to achieve:
Query user table.
Add a user via the program.
Query user table to verify add successful.

Yes there is, and there's even a guide on the Android developer site.
From an adb remote shell, you can use the sqlite3 command-line program
to manage SQLite databases created by Android applications.
Note that you can also copy the database file out of the emulator using DDMS, and then examine it with tools like SQLiteStudio.

This is an old question but if anyone still looking for this then Facebook Stetho is the best tool for debugging DB related stuff:
http://facebook.github.io/stetho/
Only downside is that you need to add a couple of line to your gradle script and application class. But well worth it.

Related

Android Sugar ORM - Custom/prepopulated database in custom SD path

I am using Sugar ORM in my Android application. I have managed to save/read data to/from the database successfully. Now I am in the need to get the created database and check some info for debugging etc. I might also need to use a prepopulated db the first time.
How can this be done in Sugar ORM? I can't find anything in the documentation.
If it cannot be done, Please propose any other easy-to-use ORM that has this ability. (Don't tell me OrmLite, it is not easy to use such as sugar orm)
I see you ask this quite a while ago but I am just finding it.
You can connect adb (Android Debug Bridge) to your device and open an adb shell.
Then in this shell navigate the shell to the database directory and use the SQLite3 command to access the database.
It works quite well in Android studio with the emulator. I have not tried it with other environments yet.
You can't do it using Sugar ORM right now. There is already an issue to pre-populate data using the migration script, see https://github.com/satyan/sugar/issues/87.
Another quite similar ORM to use would be DBFlow which is also very easy to use.(https://github.com/Raizlabs/DBFlow). I just made a POC using a prepackaged database which worked fine. See https://github.com/Raizlabs/DBFlow/blob/master/usage/DBStructure.md for more details how to do that.
Edit: Also check out ActiveAndroid which seems to be very similar to Sugar ORM and also supports pre-populated databases (https://github.com/pardom/ActiveAndroid).

database manager for android where i can add,update and do all other option like phpmyadmin in php

Is there any database manager for android where I can add,update and do all other option like phpmyadmin in PHP.
I just want to easy my work where I can add database manually without firing query.just help me because I have lots of data to insert and if I do it manually by firing query than its take around 2 months.
Thank you
There are some GUI based tools available, you can use either of any:
SQLite Manager, firefox plugin
SQLite Expert professional
FYI, there are 2 ways to integrate database in android application:
Create database from scratch using code
Use existing database (i.e. created using SQLite manager or any other third ,party tools), but here you have to write code to copy database into your application.
Search more about these 2 options and you would get plenty of resources!

How do I view my sqlite tables in my android app?

I'm working on an app that uses sqlite to store data and I need/would like to view the tables in the app to be sure things are being added correctly and the content exists. How do I review the tables and their data being used in my app.
I'm using a Nexus 7 with 4.4 on it for testing the app.
You have basically two choices.
Run the app in the emulator, then "pull" the db to your dev machine and use a tool such as SQLite Expert Personal 3 to view the db.
Create your db in the external storage instead of internal. Then you can use your USB connection to "pull" the db.
I guess I can add (3): add code to dump your tables to the log file.
I don't know this can solve your problem or not but installing THIS plugin into eclipse help me a lot to view database table and content inserted.

Sqlite plugin for Eclipse: debug sqlite database on Android device live

I want to debug database on android device. My application is very heavy and I do too much insertion queries and other stuff so running on emulator is hell slow so I am debugging it on Android phone.
But I could not debug database, like in Iphone you can see even insertion made into database. I want to see the current situation of database without rooting my phone and pulling it from my phone and then opening it into some 3rd party software.
Is there any way to debug Android database on mobile phones without rooting and pulling database out?
There is tool sqlite3 but the problem is that when you connect to shell it shows you ugly data and furthermore if database is not created running any query actually creates database in database folder so you would never knew that your database was not created by your logic.
I hope you understand what I am looking for.
I had the very same problem and after a search I found this one SQLiteManager plugin for Eclipse which is a plugin for eclipse allowing you to see and browse your data strait from SQLite DB
To use this it's easy, start you emulator, browse the emulator files in the DDMS view then
go to data > data > com.your.package > databases > your_database_name.db (note the db extension is mandatory)
and a new tab will appear with your data!
It won't work on a real device (maybe on a rooted one?)
Hope it will work for you :)
There is information on how to connect eclipse to a sqlite database here. Another alternative is using this Firefox add-on to manage your sqlite database.
I'm still looking into it myself but there is MOTODEV Studio for Android, requires free registration.
See the next simple, single JAR file.
on google code

Access Android database data in Eclipse

For a program that I have written myself, is there a method of accessing the data in an Eclipse view from inside the database? I know where the database file resides (com.blah.main > data > database > databasename), but I can't figure out how to view it, except in command line interfaces.
I thought perhaps because I'm new to Android development there was a plugin view I was overlooking that would make examining the data easier (and visually).
If you know how to access the db file from eclipse and are on windows then you can take advantage of this SQLite Database Browser to view the information after transferring it to the pc. But as far as eclipse is concerned I am not familiar with a plugin that will allow you to view the db file on the device.
For security reasons device DB are only readable by that DB's owner on the device - or via a ContentProvider that exposes the data. If your phone is rooted, you can read the databases using adb and sqlite3, see here. Motorola's MOTODEV enhancements offers a Database Explorer that might be helpful.

Categories

Resources