0% found this document useful (0 votes)
51 views6 pages

Middleware Design For Multiple Embedded Database Systems

The document proposes a middleware design for multiple embedded database systems to provide a standard API. The middleware would integrate different embedded database systems like SQLite and BerkeleyDB, allowing applications to work with different systems transparently through a single standardized interface. It reduces programming overhead and improves performance by handling the changes when switching between embedded database systems. The middleware provides basic SQL operations and manages communication between the application and the underlying databases.

Uploaded by

ITsudhank
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views6 pages

Middleware Design For Multiple Embedded Database Systems

The document proposes a middleware design for multiple embedded database systems to provide a standard API. The middleware would integrate different embedded database systems like SQLite and BerkeleyDB, allowing applications to work with different systems transparently through a single standardized interface. It reduces programming overhead and improves performance by handling the changes when switching between embedded database systems. The middleware provides basic SQL operations and manages communication between the application and the underlying databases.

Uploaded by

ITsudhank
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

MIDDLEWARE DESIGN FOR shock-resistance.

Embedded database
MULTIPLE EMBEDDED DATABASE systems like Sqlite, Berkeley DB, and
SYSTEMs GDBM etc have been proposed
forNAND – based storage systems.
Each database system have its own
ABSTRACT (API) application program interface, it is
inconvenient to write applications that
Embedded systems and consumer can work well with all embedded
electronicdevices are popular now,they database systems. So we will design a
have adopted systems such as flash- middleware for multiple embedded
memory cards or solid-state drives database systems by providing a
(SSDs).Many embedded database standard API. The middleware should
systems(EDBS) also emerge for the intgrate various embedded database
maintenance of data on these storage systems such that programmers can
systems. However, it is complicated and use the middleware to write applications
time-consuming to modify an application transparently over different embedded
with one embedded database system to database systems. The middleware will
a new one with another embed-ded provide basic operations such as
database system. In this , a design insert,delete,select and join as well as
middleware for multiple embedded embedded database systems.
database systems implemented by Furthermore, the middleware should be
considering their different interfaces responsible to reduce programming
and overhead. With the help of the overhead and improve system
middle-ware, it is convenient for users to perfomance when one embedded
write applications that can easily adopt database system will be changed to
various embedded database systems. another one.
Furthermore, the middleware can
leverage various embedded database
systems for better performance and
reasonable cost.
DESIGNING MIDDLEWARE
INTRODUCTION
every embedded database system have
Most embedded systems and consumes
an API, the programmer must learn the
electronic devices have adopted NAND
API to use the embedded database
flash-memory as this storage media
system. If the system environment does
since NAND flash-memory has
not support the embedded system,
advantages such as huge capacity, low-
programmer might modify the original
power consumption, non-volatility, and
application for another embedded
database system. It is complicated and Features of SQLite as follow:
time-consuming for programmers to
• Unlike most other SQL
rewrite applications.
databases, SQLite does not have
a separate server process.
SQLite reads and writes directly
to ordinary disk files.

Application
a
• Transactions are atomic,
consistent, isolated, and durable
(ACID) even after system
crashes and power failures.
Middlware
• Implement most functions of
SQL-92.

• Small code footprint: less than


300KB fully configured or less
than 180KB with optional features
EDBS a EDBS b EDBS c omitted.

• Sources are in the public domain.


Use for any purpose
Above diagram shows a middleware
SQLite uses its APIs to access data as
that can work well with embedded
follow:
database systems. Application can run
on EDBS a,b and c through the 1) SQLite Structure:
middleware. The middleware can play a
• typedef struct sqlite3 sqlite3.Each
transparent role of communication
open SQLite database is
between application and embedded
represented by a pointer to an
database systems. The middleware can
instance of the opaque structure
handle the change process and reduce
named ”sqlite3”. It is useful to
the overhead.
think of an sqlite3 pointer as an
MIDDLEWARE IMPLEMENTATION object.

1.SQLite 2) SQLite API: SQLite have basic


pointer structures and basic APIs for
it is an open source light weight
opening and closing the database.
embedded database system.
• int sqlite3_open(const char • programmatic administrator and
*filename, sqlite3 *). The function management – zero human
can open a SQLite database file administration.
whose name is given by the
• Sources are in the public domain.
filename argument.
Structure of berkeley as follow:
• int sqlite3_close (sqlite3 *) this
function is the destructor for the 1) Berkeley DB structure: it does not
sqlite3 object. support SQL-92 to control
databases, it has specific
SQLite can write and read from
structures to access data from
databases by a SQL-92 language
databases.
• int sqlite3_exec(sqlite3*,const
• Typedef struct{ void data; /* a
char *sql,char **errmsg /* error
pointer to a string* / u_int32_t
msg written here */). programmer
size; /* the length of data, in
just write the SQL-92 language
bytes */} DBT. DBT can store
and use sql3_exec() to control
data and data length,
databases. If programmer want to
Berkeley DB can write and
create a table, let char* sql be
read data from database by
“create table
DBT.
table_name(table_spec)” and
execute the function • Typedef struct DB DB. DB is
sqlite3_exec. the handle for a berkeley DB
database.
2.Berkeley DB
2) Berkeley DB API: Berkeley
it is a product of open source by oracle
DB uses its APIs to access
and can provide developers with fast,
data as follow:
reliable, local persistance with zero
administration. Often deployed as • db create(DB **dbp, DB ENV
embedded databases, Berkeley DB can *dbenv, u int32 t flags).db
provide high perfomance, reliability, create() function creates a DB
scalability, and availability for structure that is thehandle for
applications. a Berkeley DB database. The
function allocatesmemory for
Features of Berkeley DB as follows:
the structure and returns a
• ACID transaction pointer to thestructure in the
memory to which dbp refers.
• indexed and sequential
retrieval(Btree,Queue,hash)
• DB->open(DB *db, const char 3.Standard API Design
*db name, DBTYPE type).DB-
The middleware will integrate various
>open() method opens the
embedded database systems since
database. DBTYPE areBtree,
each embedded database system might
Hash, Queue, and Recno.
have itsAPIs. A standard API should be
• DB->close(DB *db).DB- designed and work well with all
>close() method flushes any embedded database systems.According
cached database information to our observations, SQLite supports a
to disk, closes any open SQL-92 language and table conception.
cursors, frees any allocated However, Berkeley DB does not
resources, and closes any support table conception. If we want to
underlying files. insert data with the same primary keys
into Berkeley DB, Berkeley DB has to
• DB->put(DB *db, DBT *key,
store these data into different database
DBT *data).DB->put() method
files. When we design a standard API,
stores key/data pairs in the
we should
database. The default
behavior of the DB->put()
function is to insert the new
• void create(char *db name,char
key/data pair, replace any
*table name,int flag/*which
previously existingkey if
database will be used */,char
duplicates are disallowed, or
*spec /*Like:(a INTEGER
add a duplicate data item if
PRIMARY KEY, b INT, e
duplicates are allowed.
TEXT)*/). The function can create
• DB->get(DB *db, DBT *key, a table and an initial database.
DBT *data).DB->get() method
• void insert(char *db name,char
retrieves key/data pairs from
*table name,int flag,char *data).
the database. The address
The function can insert data to a
and length of the data
database.
associated
with the specified key are • void deletedata(char *db
returned in the structure to name,char *table name,int flag).
which data refers. The function can delete data from
a database.

• void selectdata(char *db


name,char *table name,int flag,int
num,char *spec). The function overhead in adding the table
can search data from a database. conception. However,it is required when
a standard API is implemented.
• void joindata(char *db name,char
*table1 name,int num1,char
*table2 name,int num2,int flag).
In join function using middleware it can
The function can join two tables.
be observed that, SQLite was faster
than Berkeley DB , Since Berkeley DB
does not provide table conception, the
IMPLEMENTATION
middleware design should resolve the
implementation is performed on a Dual conflict when different embedded
core 2.0 Ghz intel pentium machine with database systems are integrated. Extra
3GB RAM running SUSE Linux 2.6.21.6. conversion might cause overhead in the
in this observation our data specification table conception. As a result, SQLite
is phone book, example: (ID INTEGER might have better performance when
PRIMARY KEY, Name VARCHAR(50), join operations are required.
PhoneNumber VARCHAR(50)).
From last two observation we knowthe
We will create 1000, 5000 and 10000 middleware’s overhead is to add the
records by the data specification and table conception
execute insert and join operations to into embedded database systems,
these records. especially for Berkeley DB. So we can
realize that the middleware design can
by using SQLite, we inserted 1000, provide programmers with flexibility but
5000 and 10,000 records. The execution might cause overhead for integrating
time is just a little difference between different embedded database systems.
using middleware and no using In conversion overhead, we can know it
middleware. This is because the will cause extra overhead. So we advise
middleware will just a role of programmers need to consider this
communication between application and conversion overhead and performance.
SQLite. If programmers want to change a
embedded database system to another
By using Berkeley DB we also inserted
one, the middleware will read the data
1000, 5000, 10,000 records. The
information from the original embedded
execution time with the middleware was
database system and insert the data
longer than the without the
information into the new embedded
middleware .because Berkeley DB
database system. The advantage is that
doesnot provide the table conception
and the middleware design will cause
programmers never handle how to do Reference:
the conversion process.

CONCLUSION www.ieee.org - “A Middleware Design


for Multiple Embedded
Many embedded database systems also
Database Systems”
emerge for the maintenance of dataon
these storage systems. Since it is
complicated for users to modify an SQLite3- http://www.sqlite.org
application with one embedded
database system to a new one with Berkeley DB -
another embedded database system. http://www.oracle.com/technology/produ
We propose a middleware design for cts/berkeley-db/index.html
resolving the issue. We list the
contributions of the paper in the
following:

• The middleware can provide a


standard development API for
multiple embedded database
systems and reduce
programming overhead.

• According to the development


environment, the middleware can
handle the change process
between embedded database
systems and programmers do not
rewrite applications.

• The middleware can provide


related benchmark for
programmers and determine
which embedded database
system is suitable.

You might also like