Conference PaperPDF Available

J2ME And Mobile Database Design

Authors:

Abstract

J2ME is a development platform for mobile devices and has been introduced by Sun Micro-Systems Inc. In 1999 for programming limited devices such as phones, PDAs and other small devices. But this architecture does not support APIs for data persistence management and relational database because of its limitations. This paper presents a base for local relational database and data persistence management for J2ME based applications and can be used in any database aware application in J2ME platform. In this paper and implementation of this database system mobile device and J2ME limitations have been considered. Also, the B+tree indexing structure has been implemented in this project that allows us fast insertion, deletion, range queries, search, backup and restore mechanism for RMS based databases.
J2ME And Mobile Database Design
Seyed Rebvar Hosseini
Department of Computer and Information Sciences
Institute for Advanced Studies in Basic Sciences
Zanjan, Iran
r.hosseini@iasbs.ac.ir
Lida Ahmadi
Department of Mathematics
University Of Kurdistan
Kurdistan, Iran
lida.ehmedi@gmail.com
Bahram Sadeghi Bigham
Department of Computer and Information Sciences
Institute for Advanced Studies in Basic Sciences
Zanjan, Iran
b sadeghi b@iasbs.ac.ir
Jalal Khairabadi
Department of Computer and Information Sciences
Institute for Advanced Studies in Basic Sciences
Zanjan, Iran
j.khair@iasbs.ac.ir
Armin Ghasem Azar
Department of Computer and Information Sciences
Institute for Advanced Studies in Basic Sciences
Zanjan, Iran
a.ghasemazar@iasbs.ac.ir
Abstract: J2ME is a development platform for mobile devices and has been introduced by Sun
Micro-Systems Inc. In 1999 for programming limited devices such as phones, PDAs and other small
devices. But this architecture does not support APIs for data persistence management and relational
database because of its limitations. This paper presents a base for local relational database and
data persistence management for J2ME based applications and can be used in any database aware
application in J2ME platform. In this paper and implementation of this database system mobile
device and J2ME limitations have been considered. Also, the B+tree indexing structure has been
implemented in this project that allows us fast insertion, deletion, range queries, search, backup
and restore mechanism for RMS based databases.
Keywords: J2ME; B+tree; mobile devices; data management; storage; relational; database.
1 Introduction
The mobile devices are going to be more and more pop-
ular today and the need for data oriented software for
them is growing very fast. So the need for a fast and
acceptable manner of storing and retrieving data has
been more obvious in the past few years.
The mobile applications should be interactive in a
way that they could response to user actions. For an
application that uses database and storing and retriev-
ing data, this is an important issue. since storing and
retrieving data if not implemented in a good way, can
be very lengthy and time consuming this definitely will
not let mobile platform to succeed. Also, a mobile ap-
plication Should be available in off-line mode as it is
in on-line. This issue is important if either the cost
of the data transmission over the network is high or
the network is not always available. Also, the network
speed is also an issue. Hence a data persistence man-
Corresponding Author, P. O. Box 45195-1159, M: (+98) 918 376-0623, T: (+98) 241 415-5056
CICIS’12, IASBS, Zanjan, Iran, May 29-31, 2012
agement system is needed in order to store and retrieve
information and data in the mobile device [3].
We have chosen J2ME as our development platform
because the number of mobile devices that support this
platform has been increasing in the past few years. The
JAVA virtual machine that is implemented in the mo-
bile devices is called KVM (K for Kilobyte).
J2ME virtual machine is nearly installed on every
mobile devices that has been manufactured nowadays.
Thus, for devices that does not come with KVM by
default, the custom releases by third party manufac-
turers are available (like IBM J9 for Windows Mobile
and Palm-OS and JBED and Net-Mite for Android).
But J2ME does not support JDBC, because the
classes that implement JDBC are very heavy and com-
plex for such limited devices. In J2ME there are some
options available that are JSR75 for file connection API
and Record Store Management (RMS). JSR75 needs
special permissions to access disk directly and is not a
good option for database implementation. So the later
is used in this project, that is , this system is built on
top of the RMS and uses RMS low level API’s to store
and retrieve data in the background. We know that
there is not a unique solution for database manage-
ment that supports every kind of mobile devices. That
is, all the designed systems are specifically designed for
one type of the system (for example Symbian, Android,
Palm-OS and Windows Mobile database management
mechanism are different).
So some solutions for this lack of existence of unique
DBMS has been developed. Among them, IBM Tool-
Box for J2ME [?6] for remote database access, JT-
Open [2], Point-Base Micro by Data-Mirror [3], Code-
Base Micro [4] are more important.
This implementation here uses the B+tree [5] in-
dexing structure, an indexing structure that with hash-
ing mechanism are the most powerful indexing mech-
anisms today and most of powerful database manage-
ment systems such as SQL Server and Oracle use this
type of indexes in their databases. In the next section
the database structure and implementation will be de-
scribed and section 3 will introduce an application for
this database system. Section 4 suggests other imple-
mentation ideas and will discuss future works.
2 System Internals
Till now, some information about the platform and lim-
itations has been discussed. In this section we are going
to study the internal structure of this system.
2.1 Overall system analysis
Record Store management is a mechanism for storing
and retrieving data in a J2ME application without hav-
ing special permissions. This API is a low level API
and the programmer should manipulate bytes directly.
RMS supports some basic operations and its structure
is similar to Simple File. The programmer should pack
bytes directly and then write them to database [1].
There is not any good disk data structure for data stor-
age like BTree, B+tree, Hashing, etc.
Simple SQL
RMS B+tree Database
RMS
J2ME Midllet
Table 1: System Architecture
This basic API support operations like adding
record, update a record by ID, access a record by ID,
record filters and record enumerations. But these op-
erations and their performance are not good enough
for database applications like accounting systems or
dictionaries or something like them. Also, creating ap-
plications that need relational databases is nearly im-
possible with these simple operations [1]. The main
goal here is to extend RMS capabilities for search,
backup, restore and high speed query of the stored
data. As mentioned earlier one of the most impor-
tant data structures for database system indexing is
B+Tree. This indexing method allows fast searches,
high speed range queries, addition and deletion of data
with minimal disk access. This system also supports
object serialization that is not supported directly in
J2ME.
2.2 Add Mechanism
Two types of addition are supported in the system.
The difference between them is number of records that
are being added to the database at one time. First
one is add record method that inserts a record into
database and updates the B+tree index accordingly.
The Third International Conference on Contemporary Issues in Computer and Information Sciences
This one is the fundamental method for adding data
in most applications. The other one is used when
there are multiple records waiting to be added to the
database and also they share the insertion key. For
example consider an accounting table for factor items
that we are buying and suppose that the key is factor
number.
In this situation factor items share a common key
between them, so instead of accessing disk multiple
times, addition could be done via 2, 3 or more disk
accesses, of course, this will reduce disk accessed from
20 to 2 or even smaller with respect to database proper-
ties. This will save the program some time that in the
mobile platform, this time saving is considerable. Of
course another type of addition is also supported that
this will be discussed in next sections. This mechanism
is called Bulk Loading and this will be used mainly for
Backup and restore of the saved data [2].
2.3 Search and Range Query Mecha-
nism
The system supports both types of exact search and
range query and uses B+tree properties. Since all data
are indexed search and range queries are performed di-
rectly on the index. This will speed up this type of
actions. We also know that B+tree structure has very
high performance in performing range queries. Search
and create result set methods are implemented to per-
form this operations and the programmer should in-
terpret the results. Test results on random data are
presented here [2].
2.4 Deletion Mechanism
Two types of deletion is common in database program-
ming world. One of them is physical deletion and the
other one is marking [4]. In this system the later is
used. That is, when a record is deleted, it will not
be deleted physically. This method is used by many
DBMS systems nowadays. Of course this method has
some space overhead, but considering size of memory
and space this days, this is not a big deal for database
management systems. On the other hand, the database
will be compacted in backup and restore operations.
That is, this marked records will be deleted physically
when performing this operations. Unfortunately J2ME
does not support services for running them in back-
ground, hence we do not have any real time mecha-
nism for compacting data whenever the program is not
active [2].
2.5 Updating Records
Updating records is a bit tricky. Update can be per-
formed on a record and changes different parts of a
record. If changes affect the key part of a record, the lo-
cation for the record in the B+tree index should be up-
dated. Otherwise, updating non key part of the record
is sufficient.
2.6 Backup and Restore
If we have a large collection of records, and we want
to create a B+ tree on some field, doing so by repeat-
edly inserting records is very slow. Bulk loading is a
technique to overcome this shortcoming. Bulk loading
can be done much more efficiently. This technique is
used on sorted data entries and usually is applied on a
large number of records. In this system we gain some
improvements on number of disk accesses while imple-
menting bulk loading technique. These improvements
are achieved via caching higher B+tree items for inner
nodes in main memory and write them to disk at once
instead of writing them one by one. For this purpose a
queue has been used to store a list of upper levels for
as many levels as exists and writing process uses this
queue for minimizing the number of disk accesses.
One of the applications of this method is import-
ing data from other database systems and restoring
data from system backups. Furthermore compact-
ing database for physical deletion of records that are
marked for deletion is possible via this method. Also,
this method for back up and restoring data is the best
method for this purpose, because accessing RMS file
directly and manipulating it in J2ME world is impos-
sible. So,using this mechanism will minimize number
of disk accesses and hence will minimize elapsed time
for this operations [2].
3 Case Study: J2ME High
Speed Accounting Software
For testing system, a complete accounting software
had been developed. The complete software had been
ported from Windows platform to J2ME and their op-
erations are identical. All operations are done in real
time. First step is creating the database schema. For
defining schema and opening a table, field sizes for the
records of the table are needed. So in the constructor
CICIS’12, IASBS, Zanjan, Iran, May 29-31, 2012
of the table field sizes are passed to table creator. Af-
ter this step, database is ready for all kind of actions.
After defining all the tables and creating the schemas,
tables will remain open until the programmer closes
them. This is done for speeding up the program by
reducing number of opening and closing operations on
tables. In this software a simple relational database
model had been used. Of course, the relational model
still needs more work. Taking reports is done via car-
rying out joins on tables manually.
All listings in this software are sorted. This is
one of the interesting properties of B+tree indexes
as mentioned earlier. The database system in this
software has special properties. A background queue
works simultaneously with the main program to per-
form lengthy database operations in background to
keep the user interface responding. This background
thread starts with main program and usually is used on
operations which does not affect next possible actions
or actions whose probability are low. The system with
real world data and about 30 tables had been tested
and the program speed and performance was good.
This database system can be used on any database
application like dictionaries, accounting systems, etc.
4 Discussion and Future Works
This system is still young and many new features can
be added to it. An example is Simple SQL language
manager for insert, search, query, update, delete and
other operations like creating joins. Also, the future
of database indexing technology is possibly UBTree.
However, because of limitations of mobile devices and
J2ME, porting SQL completely to this platform and
implementing a complete UBTree system is nearly im-
possible. Thus, network management and accessing
remote databases is an important matter for a DBMS.
Network manager for a database system based on
J2ME should be created carefully, because mobile net-
work and communication system is also limited com-
pared to computers. Indexing on multiple fields sep-
arately is also an idea for next works. Although data
exchange via Blue-tooth is another idea that is impor-
tant for mobile devices.
Notes
[1] IBM toolbox for J2ME. Available at http://www.ibm.com/.
[2] TJopen Available at: http://sourceforge.net.
[3] PointBase Micro Available at:http://www.pointbase.com/.
[4] Oracle Lite. Available at http://www.oracle.com/.
Refrences
[1] J. Keogh, J2ME: The Complete Reference, McGraw-
Hill/Osborne, 2003.
[2] R. Ramakrishnam., Database Management Systems,
McGraw-Hill.
[3] V. Kumar, Mobile Database Systems, John Wiley and
Sons,Inc. Hoboken, New Jersey., 2006.
[4] Siddhartha Sen and Robert E. Tarjan, Deletion Without Re-
balancing in Multiway Search Trees (2010), 125–128.
[5] R. Bayer and E. M. McCreight, Organization and mainte-
nance of large ordered indexes, Acta Informatica 1(1972),
no. 3, 173-189.
[6] A.V. Aho, J.E. Hopcroft, and J.D. Ullman, Data Structures
and Algorithms, Addison-Wesley, Reading, MA, 1987.
[7] D. Comer, The ubiquitous B-trees, ACM Computing Surveys
11 (1979), no. 2, 121–137.
[8] E. Horowitz, S. Sahni, and S. Anderson-Freed, Fundamentals
of Data Structures in C, Computer Science Press, Rockville,
MD, 1993.
[9] J. Jannink, Implementing deletion in B+-trees, ACM SIG-
MOD Record 24 (1995), no. 1, 33–38.
[10] D. Knuth, The Art of Computer Programming: Sorting and
Searching, Vol. 3, Addison-Wesley, Reading, MA, 1973.
[11] J.D. Ullman, Principles of Database and Knowledge-Base
Systems, Computer Science Press, Rockville, MD, 1988.
[12] G. Wiederhold, Database Design, McGraw-Hill, New York,
1983.
ResearchGate has not been able to resolve any citations for this publication.
Article
A breakthrough sourcebook to the challenges and solutions for mobile database systems. This text enables readers to effectively manage mobile database systems (MDS) and data dissemination via wireless channels. The author explores the mobile communication platform and analyzes its use in the development of a distributed database management system. Workable solutions for key challenges in wireless information management are presented throughout the text. Following an introductory chapter that includes important milestones in the history and development of mobile data processing, the text provides the information, tools, and resources needed for MDS management, including: Fundamentals of wireless communication. Location and handoff management. Fundamentals of conventional database management systems and why existing approaches are not adequate for mobile databases. Concurrency control mechanism schemes. Data processing and mobility. Management of transactions. Mobile database recovery schemes. Data dissemination via wireless channels. Case studies and examples are used liberally to aid in the understanding and visualization of complex concepts. Various exercises enable readers to test their grasp of each topic before advancing in the text. Each chapter also concludes with a summary of key concepts as well as references for further study. Professionals in the mobile computing industry, particularly e-commerce, will find this text indispensable. With its extensive use of case studies, examples, and exercises, it is also highly recommended as a graduate-level textbook.
Article
From the Publisher:This comprehensive resource covers J2ME architecture and explains how to build applications and services for cell phones and PDAs with J2ME. You'll also get details on security, information management, and storage, as well as advanced topics such as Mobile Information Device Profile (MIDP) and Connected Limited Device Configuration (CLDC)
Conference Paper
Organization and maintenance of an index for a dynamic random access file is considered. It is assumed that the index must be kept on some pseudo random access backup store like a disc or a drum. The index organization described allows retrieval, insertion, and deletion of keys in time proportional to logk I where I is the size of the index and k is a device dependent natural number such that the performance of the scheme becomes near optimal. Storage utilization is at least 50% but generally much higher. The pages of the index are organized in a special datastructure, so-called B-trees. The scheme is analyzed, performance bounds are obtained, and a near optimal k is computed. Experiments have been performed with indexes up to 100000 keys. An index of size 15000 (100000) can be maintained with an average of 9 (at least 4) transactions per second on an IBM 360/44 with a 2311 disc.
Article
This paper describes algorithms for key deletion in B+-trees. There are published algorithms and pseudocode for searching and inserting keys, but deletion, due to its greater complexity and perceived lesser importance, is glossed over completely or left as an exercise to the reader. To remedy this situation, we provide a well documented flowchart, algorithm, and pseudo-code for deletion, their relation to search and insertion algorithms, and a reference to a freely available, complete B+-tree library written in the C programming language.