Skip to main content

How to access a Android database by using a command line.



How to access a Android database by using a command line.

Many of us uses databases in android applications, So it is very important to know how it is store, where it is store in the device and how to access that database directly outside from your program. That is helpful to understand whether our database code working as per expectation.

Steps to do that:

1) You need to launch the emulator first. Better launch your database application from Eclipse.  ( Note: Even you can connect your real device to your PC for this. )
2) Launch a command prompt in the android platform-tools directory. ( Directory which has adb.exe )
3) type adb shell.
This will launch an unix shell on your emulator / connected device.
4) go to the directory where your database is : ( beware, Unix is case sensitive !! )
cd data/data
here you have the list of all the applications on your device
Go in your application directory 
cd com.employeedirectory
and descend in your databases directory :
cd databases
Here you can find all your databases. 
In my application, there is only one database: employee_directory
5) Launch sqlite on the database you want to check / change :
sqlite3 employee_directory
From here, you can check what tables are present :
.tables
6) enter any SQL instruction you want :
select * from employee;

Don't you think, Those steps are very simple to execute :)


Comments

  1. Looks interesting. I must try it out and comeback here to comment more. Believe me that adb is the best tool i have seen ever.

    Good refreshing, short and sweet; tweet like blog.

    Keep it up dude.

    ReplyDelete

Post a Comment

Popular posts from this blog

Protect sensitive information or credentials using Android Keystore

The Android keystore provides secure system level credential storage. With the keystore, an application creates a new Private/Public key pair, and uses this to encrypt application secrets before saving it in the private storage. We will learn how to use Android keystore to create and delete keys also how to encrypt the user sensitive data using these keys. The Keystore system is used by the  KeyChain API as well as the Android Keystore provider feature that was introduced in Android 4.3 (API level 18). This document goes over when and how to use the Android Keystore provider Android has had a system-level credential storage since Donut (1.6). Up until ICS (4.0), it was only used by the VPN and WiFi connection services to store private keys and certificates, and a public API was not available. ICS  introduced  a public  API   and integrated the credential storage with the rest of the OS.  Why to use Keystore?     ...

AWS Mobile Services

AWS Mobile Services  There are few AWS services listed below which can be used in mobile applications so that applications are sophisticated cloud-powered.  1. Amazon Cognito ( Identity )      simplifies the task of authenticating users and storing, managing, and syncing their data across multiple devices, platforms, and applications. It works online or offline, and allows you to securely save user-specific data such as application preferences and game state. Cognito works with multiple existing identity providers and also supports unauthenticated guest users . 2. Lambda      AWS Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume - there is no charge when your code is not running. With Lambda, you can run code for virtually any type of application or backend service - all with zero administration. Just upload your code and Lambda takes care of everything required to...