764 22 foster db4mobile
Post on 14-Apr-2018
231 Views
Preview:
TRANSCRIPT
-
7/30/2019 764 22 Foster DB4Mobile
1/24
Database ManagementSystems For Mobile
Devices
Robert L. Foster Jr.
November 18, 2008
-
7/30/2019 764 22 Foster DB4Mobile
2/24
Light Weight DBMS?
Definition
Purpose Examples
Tradeoffs
-
7/30/2019 764 22 Foster DB4Mobile
3/24
Formal Definition
There isnt one...
Major DBMSs can run on mostoperating systems providing fullfunctionality: MySQl Oracle etc...
What about embedded systems? Why do we need one?
-
7/30/2019 764 22 Foster DB4Mobile
4/24
DBMS For Mobile Devices DBMSs for mobiledevice should be
dedicated to
optimizing at least
one of the
following,preferably both:
poweroptimization
memorymanagement
commonality: small
-
7/30/2019 764 22 Foster DB4Mobile
5/24
Power Optimization
Mobile devices such as laptops, cellphones, PDAs, and radios have a limited
power supply.
How can we optimize our DBMS to use asfew resources as possible while providing
the necessary functionality?
What is the necessary functionality for amobile device?
-
7/30/2019 764 22 Foster DB4Mobile
6/24
Power Optimization
Continued...
Query
Add Delete
Atomicity?
-
7/30/2019 764 22 Foster DB4Mobile
7/24
Memory
Management How much memory is available on the
device at any given time?
How much of the devices internalmemory should be dedicated to the
DB?
How frequently can disk accesses bemade before latency issues arise?
-
7/30/2019 764 22 Foster DB4Mobile
8/24
Examples There are
numerous light
weight DBMSs
dedicated toaddressing these
specific issues.
How do we choosewhich system isthe best for a given
device?
-
7/30/2019 764 22 Foster DB4Mobile
9/24
Examples Whats good for the goose is notnecessarily whats good for the
gander...
Mobile phones have increasingly largeramounts of memory, and faster internetconnections.
Multi-Touch technology and GPScapabilities are a drain on batteries, andmemory.
-
7/30/2019 764 22 Foster DB4Mobile
10/24
Metrics What should we consider when choosing a light
weight DBMS for a device?
Operating System
Acidity
Contents (Blobs, Clobs, etc...)
Max Sizes:
Database
Tables
Row Size
Columns Per Row
Views (caching)
-
7/30/2019 764 22 Foster DB4Mobile
11/24
Metrics Continued...
Capabilities? Union Intersect
Inner Joins Outer Joins
Merge Language? Cost
-
7/30/2019 764 22 Foster DB4Mobile
12/24
Options
SQLite
SmallSQL
Pyrrho DBMS ScimoreDB
HSQLDB Embedded MySQL
-
7/30/2019 764 22 Foster DB4Mobile
13/24
HSQLDB Hyperthreaded Structured Query
Language
Written in Java Offers JDBC Driver 100-600k
Cross Platform OpenOffice & Mathematica
-
7/30/2019 764 22 Foster DB4Mobile
14/24
ScimoreDB Embedded
Distributed Query Language (DQL)
Text based query language
Windows Only C++
ACID
Independent process or part of your application
Free
4MB (A relatively small footprint in comparison)
-
7/30/2019 764 22 Foster DB4Mobile
15/24
SmallSQL
Java
JDBC Driver 200k No Installation Required
Provides no network interface or usermanagement...so whats it good for?
-
7/30/2019 764 22 Foster DB4Mobile
16/24
SQLite ACID C
Cross Platform
500K
Uses a Single Database File
FREE!
-
7/30/2019 764 22 Foster DB4Mobile
17/24
SQLite Continued...
Not a stand alone process A library?
Linked Function Calls Dynamically Typed (Read Weakly)
C, C++, Java, C#, and LISP bindingsavailable SQLite3
-
7/30/2019 764 22 Foster DB4Mobile
18/24
More on SQLite SQLite3 - Stand alone application provides: create database
define tables insert and change rows run queries
manage database Single application (Resides on the host
machine)
-
7/30/2019 764 22 Foster DB4Mobile
19/24
SQLite Code Samples Because of weak typing and the use of a single database file several
layers may be necessary.
SQLiteDatabaseCalls
#include "sqlite3.h"
/*Minimal SQLite3 Interface this provides the only access to SQLite3
library functions*/
sqlite3* createDatabase(char*pFilename);
int getDataFromDB(sqlite3* db, constchar* sqlCommand, char** &
data, int& rows, int & cols);
int clearOldData(sqlite3* db, constchar* sqlCommand);
int insertResults(sqlite3* db, int currentTime, constchar*
sqlCommand);
int clearEntries(sqlite3* db, constchar* sqlCommand);
-
7/30/2019 764 22 Foster DB4Mobile
20/24
Code Samples Continued...
DatabaseManager#include "SQLDatabaseCalls.h"
//Basic Interface Provided to Client Code
void* DbHandleCreate();
int DbHandleClose(void* pHandle);
bool addDatatoTable(constchar* sqlCommand);
bool clearTable(const char* sqlCommand);
bool clearTableEntry(constchar* sqlCommand);char** queryEntry(constchar* sqlCommand, int & rows, int &
cols);
void freeTable(char** table);
-
7/30/2019 764 22 Foster DB4Mobile
21/24
Code Samples Continued...
Client Code
# include "DbManager.h"
//Uses The DatabaseManager and handles all type issues and
structures
bool addPolicy(SPolicy* policy, SMode* oldMode, char* content);bool deletePolicy(constchar* modeID, constchar* policyID);
bool queryPolicy(int argc, char** argv, int & messagelen, char*&
xmlBuf);
bool deleteComplaint(int argc, char** argv);
bool deleteConflict(int argc, char** argv);
bool deleteMode(int argc, char** argv);
bool findComplaint(int argc, char** argv, int & messagelen, char*&
xmlBuf);
bool findConflict(int argc, char** argv, int & messagelen, char*&
xmlBuf);
bool findDecision(int argc, char** argv, int & messagelen, char*&
xmlBuf);
-
7/30/2019 764 22 Foster DB4Mobile
22/24
SQLite IRL 125 million copies in Mozilla Firefox.
20 million Mac OS X computers, each of which contains multiplecopies of SQLite. (In Mac OS X v10.4 Apple introduced SQLite as a
persistence layer of the Core Data API.)
300 million downloads of Skype. (The Skype service has 100 millionregistered users.)
Nokia phones with Symbian OS version 9.4 or later. (The first one isNokia 5800)
Every iPhone and iPod touch.
Google Android phones like the T-Mobile G1
-
7/30/2019 764 22 Foster DB4Mobile
23/24
Tradeoffs
Incomplete Functionality Support ACID compliance Boundary Limitations (Max Sizes)
Access Control Coding/Implementation overhead
-
7/30/2019 764 22 Foster DB4Mobile
24/24
References Comparison of relational database management systems.
Wikipedia: The Free Encyclopedia. 15 November 2008
SQLite. Wikipedia: The Free Encyclopedia. 15 November 2008
HSQLDB. 15 November 2008
SmalSQL Database - the Java Desktop Database with JDBCinterface. 15 November 2008
Scimore - High performance distributed, client/server and fullyfeature embeded SQL database. 15 November 2008
SQLite Documentation. 15 November 2008
http://en.wikipedia.org/wiki/SQLitehttp://en.wikipedia.org/wiki/SQLitehttp://hsqldb.org/http://www.smallsql.de/http://www.smallsql.de/http://www.smallsql.de/http://www.smallsql.de/http://www.scimore.com/http://www.sqlite.org/docs.htmlhttp://www.sqlite.org/docs.htmlhttp://www.scimore.com/http://www.smallsql.de/http://www.smallsql.de/http://www.smallsql.de/http://www.smallsql.de/http://www.smallsql.de/http://www.smallsql.de/http://hsqldb.org/http://en.wikipedia.org/wiki/SQLitehttp://en.wikipedia.org/wiki/SQLite
top related