SQLite

From Android Wiki
Jump to navigation Jump to search

SQLite is a programming library which implements a relational database management system. The SQLite database concept is, in contrast to other client-server systems, to be linked into the applications code, instead of providing a standalone daemon with which an application can communicate to request or write data. Because of the small size of the library itself, and the ease of use, it is esepcially interesting for embedded systems. SQLite supports a variety of SQL-  (Structured Query Language) commands with some exceptions and does not provide any access or user-management. That means, that everyone, who can access the database file, can access the data as well as write (change, delete, add) data, if he can write the database file. It therefore inherits the access permissions of the filesystem.

The binary for Android

To access a SQLite database in the Android system, a separate binary is required, which implements the interface between the database and the user. The binary is currently provided in version 3 (sqlite3), but is mostly not part of the default installation (ROM) of the system, however it can be installed from third-party sources into the /system/xbin directory. To install sqlite3 on your device, you first need to download the correct version for your Android system (you need to ensure, that you get the correct version of the binary, ARM or x86 based) and then copy it, e.g. using adb, to the correct installation directory:

Download:

(If you selected the incorrect version of the sqlite3 binary, you may get errors like: cannot locate 'sqlite3_enable_load_extension'.)

Why to install the binary?

Using the sqlite3 binary is, for a normal user, in contrast to an Android developer, totally possible, but mostly not a real benefit. With sqlite3 you can browse the databases and contents saved on the phone, which are normally only used by the installated applications, which displays or use this data in some way. Developers and more experienced users, this binary (or better: the access to these raw data) is, for the same reason, essential.