A mobile database is a database than can be connected to by a

advertisement
Sowjanya Alaparthi
ITK 478 Position Paper
Query Processing in Mobile Databases
Sowjanya Alaparthi
-1-
Sowjanya Alaparthi
ITK 478 Position Paper
Introduction:
A mobile database is the one which can be connected to a mobile computing device over a mobile network.
The mobile client and the back-end database server communicate over wireless connections. Mobile
computing provides the ability to access information at any time and place. The use of laptops, mobiles and
PDA’s is increasing and likely to increase in the future with more and more applications residing in the
mobile systems. The aim of this paper is to describe the basic query processing mechanism in any database
and show how data is synchronized between the mobile and backend databases. There are several
commercial databases available in the market, but this paper concentrates on the synchronization process in
Sybase SQL anywhere and Microsoft SQL server 2005 compact edition.
With the cutting edge technology advance in wireless and mobile computers, the query processing in a
mobile environment has become the major research area. Whatever the advancements are, the basic query
processing mechanism remains the same. Following diagram illustrates the two major operations in query
processing. The pull and push operations. [1]
A pull operation occurs when the mobile client gets data from the backend database server. A push
operation occurs when the changes that are made to the data on the mobile database are sent to the backend
database. Caching mechanism is used to cache frequently accessed database items that are either pulled or
pushed. Caching is very much useful in unexpected situations like server failure, channel distortion, and
disconnection. [1] In the next part of the paper I will be discussing about two of the most popular
commercial mobile databases in the market namely SQL Anywhere and SQL Server 2005 Compact
Edition.
Sybase SQL Anywhere [8]
SQL Anywhere offers a wide range of options for exchanging data with existing enterprise systems and
mobile devices. In SQL anywhere the remote database, together with its application is refered as mobilink
client. The mobilink clients communicate with the consolidated database over a network through mobilink
server. This communication can occur by using either TCP/IP or HTTP or HTTPS. A mobilink server acts
as an interface between the mobilink clients and the consolidated database. A consolidated database is the
large enterprise level database which exists in the organization. The consolidated database can be Oracle,
SQL Server, DB2 and adaptive server enterprise. The mobilink server maintains the state information in the
system tables on the consolidated database. The mobilink server uses ODBC driver to communicate with
the consolidated database.
-2-
Sowjanya Alaparthi
ITK 478 Position Paper
MobiLink offers session-based, bi-directional synchronization. It is designed for exchanging data between
a consolidated database and remote SQL Anywhere databases. The consolidated databases can be any
datasource like an application server, web server, etc. Remote database will commit changes and those
changes will be sent to the consolidated database and vice versa. During synchronization the client must
maintain a session with the synchronization server. Normally clients initiate the synchronization process
and after the connection is established Mobilink client can upload the changes to synchronizing server. The
upload can be an insertion, deletion or updation of row values. Mobilink server then commits the
transaction. During download from Mobilink server to Mobilink Client a new transaction is opened on the
consolidated database. Synchronization logic is written in SQL, JAVA or .NET for upload and download
purposes. SQL synchronization logic is best when synchronizing to a supported consolidated database.
Synchronization process is made secured by password based user authentication system
During MobiLink synchronization, the remote database updates the changes that were made to it since the
previous synchronization with the MobiLink server. On receiving this data, the MobiLink server updates
the central database and then downloads changes from the central database to the remote database. It also
ensures the transactional integrity of the databases in the event a connection between them is lost, and
provides mechanisms for the resolution of data change conflicts. MobiLink file transfer functionality lets
you transfer files to remote applications on the same connection you use to synchronize data, which is
useful when populating new remote databases or upgrading software. In addition, MobiLink provides direct
row handling for synchronizing remote data with any central data source. The data sources to which you
can synchronize can include an application, web server, web service, application server, text file,
spreadsheet, non-relational database, or an RDBMS that is not supported as a consolidated database.
Remote database commit changes and those changes will be send to the consolidated database and vice
versa.
Features:
1. Mobilink supports Multi user synchronization.
2. Changes to the database can be made at any location as it is bi-directional synchronization. Upload and
download to the database can be done in single transaction. SQL anywhere can run with a minimum of
4MB memory.
3. MobiLink clients enforce referential integrity when they incorporate the download stream into the
remote database. Rather than failing the download transaction, the MobiLink client automatically deletes
all rows that violate referential integrity in mobile computing environments.
4. It includes scalable data synchronization technology that provides change-based replication across many
mobile databases
5. Gives us a choice of protocols to use. Synchronization can be carried over TCP/IP, HTTP, HTTPS.
6. Allows us to choose the selected portion of data to be synchronized using synchronization logics written
in Java or .Net
-3-
Sowjanya Alaparthi
ITK 478 Position Paper
SQL Server 2005 Compact Edition: It is a mobile relational database produced by Microsoft for
applications that run on mobile devices and desktops. The latest release is the SQL Server 2005 Compact
Edition (version 3.5) supports Exchange of data between Microsoft SQL server 2005 Compact edition
(SQLCE) and SQL server in two ways[3].
1. Remote data access and
2. Merge replication
Merge Replication [7]: Merge replication in SQLCE is ideally suited to remote clients and devices as
it enables autonomous data updates in the client application and on the server. In a disconnected
environment any changes made to the data in the mobile database can be synchronized when a connection
is reestablished. In this the data is distributed among publisher (one who posts) and subscriber (one who
receives). In this process publisher and subscriber can make any changes to the data, irrespective of the
connection status. As the name illustrates merge replication, there is a merging of updated data when
publisher and subscriber connect. In SQLCE 2005, the publisher can be SQL server 2000 or SQL server
2005 and the subscriber is any SQL mobile database. The data is published inside a folder called snapshot
folder, which now is the central location from which the mobile clients access the data. The publisher, i.e.,
SQL server 2000 or SQL server 2005 will keep the data updated at scheduled intervals or when a request is
made. Replication method has four components[6]:

SQL server mobile database engine is used to keep track of updates, insertions, deletions made to
records.

SQL server mobile client agent is a main replication component that implements replication object
interface.
-4-
Sowjanya Alaparthi
ITK 478 Position Paper
 SQL server mobile server agent is used for communication between publisher and subscriber.
Whenever a client agent makes a HTTP request, SQL server mobile client agent residing in IIS
takes care of the request.

When there is synchronization, the SQL Server Reconciler invokes the SQL Server Mobile
Replication Provider. When the SQL Server Reconciler is started, a Merge Agent at the Publisher
is associated with the subscription.
Remote Data Access (RDA)[5]: Similar to the above method, in this method an application accesses
the data from remote SQL server database and stores it in local SQL server mobile database and it is called
pulling. Any changes made to Local SQL server database are updated by application back to the SQL
server database later, and this is called pushing. To do the above operations we perform the SQL statements
on remote SQL server database. Here also IIS is used for communication. RDA method has 3 components.
The SQL Server Mobile Database Engine manages the SQL Server data on the device for each record. The
SQL Server Mobile Client Agent is the component responsible for implementing the RDA object interface.
Applications call this interface to programmatically control RDA. SQL Server Mobile Server Agent
resides on computer running IIS and handles the HTTP requests made by the SQL Server Mobile Client
Agent.
Comparing Merge replication and RDA[4]:
1.
Replication is better than RDA in providing the conflict reporting mechanism for rows that cannot be
updated on the computer that is running SQL Server during a push operation. Conflicting rows in RDA
are strictly defined as insert, update, or delete operations that fail because of an error when pushed
from SQL Server Mobile to the SQL Server table
-5-
Sowjanya Alaparthi
ITK 478 Position Paper
2.
3.
Although RDA does not provide a specific resolver the way that replication does, SQL Server Mobile
provides an error table that captures all conflicting rows during the push operations. By using the error
table, you can develop applications to manage conflict detection and reporting.
When the data is published by the publisher the mobile clients access data from the snapshot folder
which in turn reduces the number of connections which are made to the central database.
Conclusion:
The advantage of using SQL anywhere is that, a consolidated database can be one of the ODBC-compliant
databases like Adaptive Server Anywhere, Adaptive Server Enterprise, Oracle, IBM DB2, and Microsoft
SQL Server. But in SQLCE, it should only be a SQL server. SQL CE works well in environments where all
the applications and databases are Microsoft products. SQL anywhere can work in mixed environments
where the applications and databases can be from different vendors. SQL Anywhere synchronization
scripts can be written in SQL, Java, or .NET programming languages, but in SQL CE scripts can be written
only in TSQL and .NET. Role based security and permissions at a table level were not included in SQLCE.
From the above discussion I would support SQL anywhere database as it supports multiple consolidated
databases and also the synchronization process is better than SQLCE.
References:
1. Agustinus Borgy Waluyo et al., Research in mobile database query optimization and
processing, Mobile Information Systems, Volume 1 Issue 4, Dec 2005
2. http://www.sybase.com/products/databasemanagement/sqlanywhere
3. Microsoft,http://download.microsoft.com/download/7/f/c/7fc20778-4e2e-4944-b432ed74b404e542/sqlservercompactdatasheet_final.doc
4.http://technet.microsoft.com/en-us/library/ms172916.aspx
5. http://technet.microsoft.com/en-us/library/ms172395.aspx
6. http://technet.microsoft.com/en-us/library/ms171927.aspx
7. http://technet.microsoft.com/en-us/library/ms172385.aspx
8.
http://infocenter.sybase.com/help/topic/com.sybase.dbmgen_1001/pdf/dbmgen10.pdf?nof
rames=true
-6-
Download