Last time we discuss the Sqlite Interface with OS and browsers so know we thought to dive deep in to Sqlite OS interface so this time we have chosen Sqlite Android Interface to be a topic of discussion. Android stores its data using Sqlite database engine which is an independent transactional engine for accessing and management of database. It requires no dedicated server process. Most application and platforms beyond the mobile operating system Android use Sqlite. Unlike the desktop based databases, Sqlite cuts short the features that are not necessarily important and as a result achieves minute footprint.
Database systems use the static typing while Sqlite prefers manifest typing instead. It pushes the data type information accountability to high-end computing languages like; Java. This maps the structure of database to high-end types.
Reasons Why Android Uses Sqlite
Most importantly, the key feature that Sqlite is chosen for is its reliability. A majority of the project codes are devoted for library testing. And the library is structured in a way that it can handle system failures of different types such as; disk errors, low storage memory, or power failure.
It is ensured that a database is never left in an unrecoverable state because all the essential data for mobile phones are stored within a database file. Therefore, using Sqlite is a fortunate step as it makes the mobile database insusceptible to corruption that could easily take place. If not, every time that the battery discharges, a database corruption would take place.
Other Grounds On Which Android Uses Sqlite
Delving Into the Sqlite Database for Android and Its Structure
Android and other mobile operating systems come with Sqlite integrated in their environment and thus are used by applications designed for it. The primary data repository for android is Sqlite and all of its databases are located on the respective device location:
The Database files for each application are located within a subfolder in its section of the file system. An application DB is kept private to the application itself and is protected by File System permissions of Linux. However, the database is not in an encrypted state and can be opened and viewed in the right environment. Basically the data base file for each application is stored in the mentioned location (differs on the basis of Android version) and is named after the application name itself.
The database can be viewed using the Dalvik Debug Monitor Service of an emulator. However, if a physical device is being used then browsing may not be possible until or unless the device is routed.
NOTE: DDMS () comes as a part of the software development kit, Android SDK which enables to design and develop apps for the OS. The kit also includes emulator, source codes with sample projects, development utilities, and libraries for app building along with DDMS.
Understanding the Database Structure
A common database is assigned for the entire application data storage. This DB file consists of tables with corresponding information and each table has multiple pages and in it are cells denoting each entry. These pages are mostly structured in B-tree format where one page is a compilation of a particular number of bytes which has a size with a power of 2. All pages in a database are of the same size and are structured with numbering starting with 1.
For instance, here is the view of database file created by a dictionary application on Android.
Following is a view at the ‘word_types’ table in the dictionary application database .
Variety And Evolution in Android File System
EXT or the Extended File System is a genuine, Linux developed file system. Though Linux supports a number of file systems, EXT remains its default. Post the release of original EXT version, three more version releases took place; EXT2, 3 and 4 respectively.
Coming over to the point, earlier Android devices did not have EXT though it had been a built-in in most of the desktop, laptops, and Linux distribution server. But very soon Android Developers made a move of the Mobile OS based device file systems from YAFFS to EXT.
The move was initiated owing to a number of reasons, which included:
The types of file systems Android has had over the time are: YAFFS, YAFFS2, ext2, 3, 4, and vfat. YAFFS was a robust file system supporting NOR / NAND flash chips. Also, were designed to particularly be used in embedded devices. While EXT and its versions were a Linux based file system that introduced lots of improvements like; ext2 was developed to resolve ext issues, ext3 further added the facility for journaling, and the fourth edition (currently in use) made the provision for large FS and file size support. Meanwhile vfat is a FAT32 file system by Microsoft dedicated for SD cards.
Conclusion: The above information shows that, though a common database is accessible using commercial tools, main application database for any Android device can only be acquired with the right environment, tools/platform. The limitation is basically a plus point about Sqlite database as though they aren’t easily corruptible but are also not provided access of, to end users. You can also explore the Android Sqlite by using a freeware utility such as Sqlite Browser.