Android SQLite database simple operation (ADB shell)

Source: Internet
Author: User
Original Works are allowed to be reprinted. During reprinting, be sure to indicate the source of the article: Ghost. Otherwise, legal liability will be held.

1. Use adb.exe to find a running device (at least one simulator must be enabled)

E: \ Android-SDK-Windows \ platform-tools \ ADB Devices

List of devices attached
Emulator-5554 Device

2. If the simulator is not running, run the following command to start

E: \ Android-SDK-Windows \ tools \ emulator.exe @ avdname

3. Run the following command to view the Virtual Device

E: \ Android-SDK-Windows \ tools \ Android list AVD

Available Android Virtual Devices:
Name: 2_3_3
Path: C: \ Documents ents and Settings \ Administrator \. Android \ AVD \ 2_3_3.avd
Target: Android 2.3.3 (API level 10)
Skin: 320x533
Sdcard: 50 m

4. Open a shell on the connected Device

E: \ Android-SDK-Windows \ platform-tools \ ADB Shell

5. view your own database

# Ls-r/data/*/databases

/Data/cn.edu. xtu. tilepuzzle/databases:
Dbtilepuzzle. DB

/Data/COM. Android. Browser/databases:
Webview. DB
Webviewcache. DB
Browser. DB

/Data/COM. Android. Clock/databases:
Alarms. DB

/Data/COM. Android. Email/databases:
Emailprovider. DB
Emailproviderbody. DB

/Data/COM. Android. inputmethod. Latin/databases:
Userbigram_dict.db
Auto_dict.db

/Data/COM. Android. launcher/databases:
Launcher. DB

/Data/COM. Android. providers. Contacts/databases:
Contacts2.db

/Data/COM. Android. providers. Downloads/databases:
Downloads. DB

/Data/COM. Android. providers. Media/databases:
Internal. DB
External-8f72d02.db

/Data/COM. Android. providers. Settings/databases:
Settings. DB

/Data/COM. Android. providers. telephony/databases:
Telephony. DB
Mmssms. DB

/Data/COM. Android. providers. userdictionary/databases:

User_dict.db

6. Find your own database

/Data/cn.edu. xtu. tilepuzzle/databases:
Dbtilepuzzle. DB

7. Open the database

# Sqlite3/data/cn.edu. xtu. tilepuzzle/databases/dbtilepuzzle. DB


8. query the data and simple operations of existing tables (tablegamedata and tablepeopleinfodata are the database tables I created in advance)

SQLite> select * From tablegamedata;

/Rs/raw/img/first.jpg | Y | 4 | 5

SQLite> select * From tablepeopleinfodata;

Liuyaohua | 50
Daiqing | 100
Yaohua | 14

SQLite> insert into tablepeopleinfodata values ("liu1", 1000 );

Liuyaohua | 50
Daiqing | 100
Yaohua | 14
Liu1 | 1000

SQLite> Update tablepeopleinfodata set time = 140 Where name = "Yaohua"

SQLite> select * From tablepeopleinfodata;
Liuyaohua | 50
Daiqing | 100
Yaohua | 140
Liu1 | 1000

SQLite> Delete from tablepeopleinfodata where name = "liu1 ";
SQLite> select * From tablepeopleinfodata;
Select * From tablepeopleinfodata;
Liuyaohua | 50
Daiqing | 100

(In this way, you do not need to use "system. Out. println" to view the table information changes in the database every time)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.