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?     ...

Certificate and Public Key Pinning in Android

Certificate and Public Key Pinning in Android. Now a days it’s very easy for an attacker to intercept the request and responses in secured channel ( SSL / TLS ).   This allows the attacker to get in the middle of the conversation between a client and server. They could be just eavesdropping on the conversation or could be changing the data as it moves to the client or server. This kind of attack is known as “Man in the Middle Attack” (MiTM). You can read more about MiTM attack here ( https://en.wikipedia.org/wiki/Man-in-the-middle_attack ) What is Certificate Pinning or Public key pinning?                 Certificate Pinning is most often used to address the scenario above, i.e. to keep unwanted eyes from looking into a mobile application’s traffic. Certificate pinning is hardcoding or storing the information for digital certificates/public keys in a mobile application. In mobile application...