Research and Application of Sqlite Embedded Database Technology
Total Page:16
File Type:pdf, Size:1020Kb
WSEAS TRANSACTIONS on COMPUTERS Chunyue Bi Research and Application of SQLite Embedded Database Technology CHUNYUE BI School of Computer Science and Information Technology Zhejiang Wanli University No.8, South Q ian Hu Road Ningbo, Zhejiang P.R.CHINA http://www.zwu.edu.c n Abstract: - The embedded database SQLite is widely applied in the data management of embedded environment such as mobile devices, industrial control, information appliance etc., it has become the focus of the development of related areas. For its advantages of stability and reliability, fast and high effic iency, portability and so on, which occupies the unique advantages among many of the main embedded databases. This paper first describes the definit ion, basic characteristics, structure and the key technologies of embedded database, analyses the features, architecture and the main interface functions of SQLite, gives a detailed porting process from SQLite to ARM-Linux platform, and discusses concrete application of SQLite in embedded system through a development case about the home gateway based on ARM-Linux. Key-Words: - Embedded Database; SQLite; Porting; ARM-linux; Home Gateway 1 Introduction of conveniences for the development of embedded With the development of information technology, devices. Domestic products include Xiao-J in-Ling embedded operating system opens up a new embedded database system KingbaseLite, development space for database technology OpenBASE Mini developed by Neusoft Group, etc.; according to the requirements of mobile database international products include Sybase's Sybase system. With the popularity of Intelligent Network iAnywhere, IBM's DB2 Satellite and DB2 Devices, Mobile Terminals, Information Appliances, Everywhere, Oracle's OracleLite, etc., in addition, embedded database technology has gone from embedded database based on the Linux open-source research fields into a wide range of application fields, platform has also appeared in the market, such as the close combination between a variety of Mysql, Berkeley DB, SQLite, and so on, which embedded equipments and embedded database provide easy-to-use interface API, promote the technology has been taken seriously. Because of the development of open-source software, and facilitate popularity of mobile terminals, the users improve to access data and manage data. In addition, the new continuously the real-time processing and research and application in different fields emerge management of mobile data, they are eager to do endlessly, especially in some novel fields like mobile more effective management for the embedded equipment, Automatic Test System and products data, the market based on embedded Communication System, etc., therefore, with the database application has also entered an accelerated rapid development of embedded technology and development phase. wireless communication networks, the research on In recent years, a great many database products embedded database will become even more appear on the domestic market continuously, such as important. IBM DB2, Oracle, Sybase, SQL Server, and so on. Nowadays, embedded database technology has However, all these databases are restricted by become a hot research field, the major database capacity and power consumption of embedded vendors have launched their own products, although system, and can’t meet the needs of users, especially these products are embedded field oriented, they when the scales of the mobile users become very have their own characteristics on the specific large. The traditional database is much slowly and it technical specifications. SQLite has attracted ties up too much computer memory in some real- strongly the majority of developers for its advantages time systems, while the embedded database shows such as lightweight, easy to port, without copyright excellent performance in related fields. At present, a restrictions and so on. large number of embedded databases have appeared in the international and domestic, they provide a lot ISSN: 1109-2750 83 Issue 1, Volume 8, January 2009 WSEAS TRANSACTIONS on COMPUTERS Chunyue Bi 2 The Definition and Characteristics, approach. Since embedded database system and universal database system are not the same in the Structure and the Key Technologies of running environment, and many other applications, Embedded Database the embedded database can’t be simply regard as a miniature of the universal database, it has its own characteristics [2][3][4]. 2.1 The Definition and Characteristics of (1) Occupy the less space and small memory resources Embedded Databas e In general, embedded database system can be defined The disk space required in embedded database is from the architecture [1]. Embedded database system very small, and we can limit the size and quantity of is a Database Management System that supports the data structure such as data tables, records, and mobile computing or a particular computing mode, other technologies to reduce the disk space for which is usually integrated with the operating system embedded database. The memory space of embedded and specific application, and running in the devices is also very small, so embedded database intelligent embedded devices or mobile devices. must be able to run in the limited memory space. Because the embedded database always combines (2) Reliability, manageability and security with mobile computing, it is usually also known as The embedded database is generally used in the embedded mobile database. Embedded database mobile environment, the requirements of embedded technology concerns several subject areas such as the systems not only must be reliable, but also can run database, real-time systems, distributed computing normally without artificial management. and mobile communications technology and so on, (3) Interoperability and portability which has become a new direction of research and In general, embedded database is designed and application about the database technology implemented for the specific development platform development. The structure of Embedded System and operating system, in order to ensure gives the importance of embedded database, as is communicate with other databases, in the shown in Fig.1. development process, the interoperability among the databases is of great importance; at the same time, the operating system and hardware environment used in various embedded devices are different, the portability of embedded database must also be considered in design. (4) Scalability Due to its characteristics of embedded systems, embedded database must support the scalability, so that we can save disk space and improve efficiency. 2.2 The Architecture of Embedded databas e Embedded database is similar to traditional database, and it consists of three levels, namely, internal level, Fig.1 Structure of Embedded System conceptual level and the external leve l [5], as is shown in Fig.2. From the above diagram, we can see that, as a software middleware of embedded system, the embedded database will be bound to be restricted by the speed of embedded systems, resources, application and other factors. Embedded database system is essentially similar to the usual database system, which can be level, network, relational database, and be also object-oriented style. The differences between the embedded database and traditional database are as follows: embedded database is directly driven by procedure, i.e., call the corresponding API function to access data, while traditional database is driven by engine response Fig.2 Architecture of Embedded database ISSN: 1109-2750 84 Issue 1, Volume 8, January 2009 WSEAS TRANSACTIONS on COMPUTERS Chunyue Bi good embedded database need to deal with various The conceptual mode is the global logic key technologies [6]. description of DB and it is independent of all the (1) Replication and Synchronization others; The external mode is the interface between When mapping with server database, embedded users and DBS and programmers only to store and database usually takes some kind of data replication manipulate data according to the framework of mode, so users can access to any data at all times. external mode and need not pay attention to Because of data replication, a variety of necessary conceptual mode; The internal mode is the synchronization processes are required between description of DB in physic storage and it gives the various application front-ends and various back-end definitions of all internal record type, index, file servers in the system. arrangements and the methods how to control the (2) Backup recovery data. The conceptual mode provides a relatively The backup of embedded database is different steady middle part to restrict the other two parts from the usual database, it can’t be independent of (external and internal parts). the service, but in accordance with a simplified If the requirements of Real-Time are very high, manner. we can directly deal with the physical files of (3) Transaction processing database without through conceptual leve l, and it no Transaction processing in embedded database longer carries out mapping from external mode to system can be simplified in the front-end, but in the conceptual mode and from conceptual mode to entire application system, it may need to be memory mode. combined with the characteristics of mobile Embedded DBMS is a software system which computing environment to control and deal with manages the data in the embedded database system, transactions. and which consists of three program modules, (4) Security namely, the language