View and manage SQLite databases in Android

Source: Internet
Author: User
Tags sqlite manager

You can use the Eclipse plug-in ddms in Android or the ADB tool in the android toolkit. The SQLite database in the android project is located at/data/Project package/Databases.

Use ddms to export the SQLite database.

1. First open the debugging mode of the android project and find the display ddms:

Select ddms

2. Switch to ddms and display the file Explorer window. Find/data/

Find the folder of the package and open databases to view the SQLite database file. Select to export it.

In this way, the SQLite database file is exported as a file, and then you can use the SQLite interface management tools such as SQLite administrator, SQLite man, or Firefox plug-in SQLite manager to open the file.

Use ADB to access the SQLite Database

Android debug bridge (ADB) is a common debugging tool for Android. It can update the code in a device or simulator, manage a predetermined port, and run shell commands on the device, we know that android is based on the Linux kernel, and its internal file structure adopts the Linux file organization mode. Therefore, shell is used to access its file structure. This time, we will use shell to access the SQLite database file in the Android Application.

Run "1" and switch to "android-sdkdirectory". Run "adb.exe" and add the shell parameter. "#" indicates that the "shell" command mode is enabled. Note that "ADB" can only enter the "shell" mode when running the android simulator:

2. shell commands remember the two basic commands LS and CD. Similar to the Dir and Cd in the Windows Command Prompt line, the command lists the files in the current directory and enters the specified directory. After understanding the two commands, you can find the data/Project package name/Databases:

Find the database file:

The next step is to use the SQLite management tool for operations. Type sqlite3Database NameNow we enter the SQLite management mode.

Sqlite3.exe is included in androidsdk. it is an official SQLite management tool and a command line tool. For ease of use, register the path to the system environment variable path, that is, add % android_home % to the path, so that you can directly open the SQLite management tool by running sqlite3.

SQLite Database Management

By default, the SQLite command line tool uses the; concluding remarks. Therefore, if only one line of statements is required, add; At the end, or type; In the next line, the SQLite command will be executed.

SQLite Common commands:

. Tables -- view the table list of the database

. Exit -- exit the SQLite command line

Other commands can be used at any time. Help to view help. The SQL command can be executed directly on this command line:

Recommended books: Android technology Insider: System

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.