Method of using SQLite3 command line to view embedded database in Android

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

【1】 In Android programs, generally, the created databases are stored in the directory of / data / data / [application package name] / databases.

【2】 CD command: folder jump command. Ls command: view which files are under a folder.

【3】 Use the "SQLite3 [database name]" command to perform a series of operations on a database.

【4】 After step [3], you can use the. Tables command to view which tables are included in a database. To query the data contained in a table, enter the query SQL statement after the SQLite > command, but note that the input of the statement should be ended with a semicolon [;].

【5】 If you enter the ADB shell in the command line, you will be prompted that ADB is not an internal or external command, nor a runnable program, or a batch file. This situation is caused by the problem that the environment variables are not set properly. Solution: find the directory where the ADB tool is located under the installed Android SDK package directory, usually in... \ Android SDK windows \ Tools Directory or... \ Android SDK windows \ platform tools directory. Add the directory to the path environment variable.

PS: view the Android SQLite database from the command line

View SQLite database from the command line:

Start simulator

Command line CD to Android SDK windows \ platform Tools Directory ADB shell. / / enter the simulator CD / data / yourpackagename / / / enter the software installation directory CD databases. / / enter the database directory ls. / / view the existing database, If the database is created, there should be xxxx.db SQLite3 xxxx.db. / / open the database with SQLite3. / / the following is the SQLite3 command SQLite >. Tables. / / view the tables in the database. In this example, you should see the table yyyy SQLite >. Schema yyyy. / / view the table structure SQLite > select * from yyyy// Query table

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>