How to view an embedded database using the SQLite3 command line in Android _android

Source: Internet
Author: User
Tags sqlite sqlite database

In the figure above, except for the last red box, the other boxes are commands under the ADB shell.

"1" in the Android program, databases that are typically created are stored in the directory of the/data/data/[application package name]/databases.

"2" CD command: Folder Jump command. ls command: See what files are under a folder.

"3" uses the Sqlite3 [database name] command to perform a series of operations on a database.

"4" After the "3" step, you can use the. Tables command to see which tables are included in a database. To query the data contained in a table, enter the query's SQL statement after the sqlite> command, but be aware of the semicolon [;] To end the input of the statement.

"5" If you enter the ADB shell at the command line, it prompts: The ADB is not an internal or external command, nor a running program, or a batch file, which is caused by an issue where the environment variable is not set up properly. Workaround: Locate the ADB tools directory in the installed Android SDK package directory, usually in the ... \android-sdk-windows\tools directory or in ... \android-sdk-windows\ The Platform-tools directory. Adding the directory to the PATH environment variable is OK.

PS: Command line view Android SQLite database

Command line View SQLite database:

Start simulator

Command line CD to android-sdk-windows\platform-tools directory
adb shell   //Enter emulator
cd/data/data/ yourpackagename/     //Enter the software installation directory
CD databases //Enter to the database directory
ls  // View an existing database, if you have created a xxxx.db
sqlite3 xxxx.db  //Open database with the Sqlite3 tool
//Below is the sqlite3 command
Sqlite>. tables  //View the tables in the database This example should be able to see the table YYYY
sqlite>. Schema yyyy  //view table structure
sqlite> SELECT * FROM yyyy; //query table

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.