A Quick Look at Open Source Data­bases for Mo­bile App De­vel­op­ment

Data is the life blood of the IT world. It is gen­er­ated in great vol­umes in the course of our ev­ery­day lives. Ef­fi­cient data man­age­ment calls for the use of data­base man­age­ment sys­tems (DBMSs). This ar­ti­cle presents read­ers with a se­lec­tion of pop­u­lar ope

OpenSource For You - - Contents -

Or­gan­i­sa­tions to­day have a wide choice when it comes to choos­ing ef­fi­cient data­base man­age­ment sys­tems (DBMSs). Var­i­ous IT gi­ants like Or­a­cle, Mi­crosoft, IBM and SAP of­fer high-end so­lu­tions that ad­dress all sorts of data­base re­quire­ments. Even newer IT com­pa­nies like Ama­zon, Google and Rackspace have en­tered the fray, of­fer­ing cloud­re­lated fea­tures with re­gard to databases. Ac­cord­ing to Gart­ner an­a­lyst, Merv Adrian, 92.1 per cent of DBMS rev­enue comes from com­mer­cial soft­ware. Yet, new data is find­ing its way to open source databases as devel­op­ers are opt­ing for more con­ve­nience.

Open source cloud com­put­ing and data­base adop­tion is to­day wide­spread, as these databases pro­vide huge ben­e­fits and are be­com­ing a strong so­lu­tion for ev­ery data man­age­ment need within or­gan­i­sa­tions. The DBMS space has been con­sid­er­ably im­pacted by the open source soft­ware (OSS) move­ment. The adop­tion of MySQL, Mari­aDB and other databases is sav­ing or­gan­i­sa­tions a lot of money, which would have oth­er­wise been spent on li­cences and main­te­nance. Over re­cent years, var­i­ous open source data­base projects have at­tained the ma­tu­rity stage. In ad­di­tion to cost sav­ings, open source databases of­fer very easy tweak­ing, scal­ing and, over­all, are fea­ture-rich.

Apart from pro­vid­ing a solid back­bone to en­ter­prises in stor­ing, re­triev­ing and ma­nip­u­lat­ing reg­u­lar data dur­ing typ­i­cal day­to­day op­er­a­tions, open source databases are also be­com­ing a strong choice for mo­bile app devel­op­ers.

Mo­bile op­er­at­ing sys­tems have gained much pop­u­lar­ity. An­droid and iOS have sur­passed Win­dows OS as the most used op­er­at­ing sys­tems in the world. As mo­bile OSs and mo­bile hard­ware are be­com­ing more pow­er­ful, with mo­biles be­com­ing fully func­tional smart com­put­ing de­vices, data com­pu­ta­tion from mo­biles is also in­creas­ing.

Databases are re­garded as the most ob­vi­ous way of stor­ing and ma­nip­u­lat­ing data. In the be­gin­ning, databases on mo­bile apps were han­dled on the server side or on the cloud. Mo­bile de­vices only com­mu­ni­cated with them via the net­work. How­ever, with the pas­sage of time, to make the ap­pli­ca­tions more re­spon­sive and less net­work de­pen­dent, off­line databases have been gain­ing pop­u­lar­ity. Nowa­days, mo­bile apps store en­tire databases on the phone or have the op­tion of keep­ing the data on the cloud, with syn­chro­ni­sa­tion once a day, de­pend­ing on the net­work con­nec­tiv­ity. This leads to faster and more re­spon­sive ap­pli­ca­tions.

Mo­bile databases

A mo­bile data­base is one that a mo­bile com­put­ing de­vice can con­nect to over a wire­less net­work. Mo­bile databases can fur­ther be clas­si­fied as those that are phys­i­cally sep­a­rate from the cen­tral data­base server, those that re­side on mo­bile

de­vices, and those ca­pa­ble of com­mu­ni­cat­ing with a cen­tral data­base server or other mo­bile clients from re­mote sites and han­dling lo­cal queries with­out con­nec­tiv­ity.

Mo­bile DBMSs should sat­isfy the fol­low­ing re­quire­ments:

Small mem­ory foot­print

Flash­op­ti­mised stor­age sys­tem

Data syn­chro­ni­sa­tion

Se­cu­rity

Low power con­sump­tion

Self-man­age­ment

Strong co­or­di­na­tion via em­bed­dable fea­tures in ap­pli­ca­tions There are many mo­bile databases avail­able in the mar­ket with many new ones also emerg­ing, but it is the de­vel­oper who has to choose the right data­base that sat­is­fies all the re­quire­ments of the par­tic­u­lar mo­bile app be­ing cre­ated.

A few pop­u­lar open source databases de­signed es­pe­cially for mo­bile apps are dis­cussed here.

SQLite

SQLite data­base is a small, highly re­li­able, em­bed­ded, fully­fea­tured, com­pact and self­con­tained re­la­tional DBMS avail­able as a pub­lic do­main soft­ware pack­age. As com­pared to other data­base man­age­ment sys­tems, SQLite is not a client­server data­base en­gine. It is re­garded as a pop­u­lar data­base, es­pe­cially for ap­pli­ca­tion soft­ware like Web browsers and even for mo­bile app devel­op­ers to store data from front­end mo­bile apps. SQLite of­fers an amaz­ing set of tools to han­dle all sorts of data with ease and fewer con­straints, com­pared to hosted and process based server re­la­tional databases.

Fea­tures

Server­less: It doesn’t re­quire a sep­a­rate server process or sys­tem to op­er­ate. Its li­brary has di­rect ac­cess to stor­age files.

Zero con­fig­u­ra­tion: No server is re­quired, which means ‘No setup’. Cre­at­ing a SQLite data­base in­stance is as easy as open­ing a sim­ple file.

Cross­plat­form: It is avail­able for var­i­ous plat­forms like An­droid, BSD, iOS, MAC, So­laris, Win­dows and VxWorks. Self­con­tained: The en­tire data­base is con­tained in a sin­gle li­brary and is in­te­grated into the host ap­pli­ca­tion. Trans­ac­tional: SQLite trans­ac­tions are fully ACID­com­pli­ant, which al­lows safe ac­cess from mul­ti­ple pro­cesses.

Re­li­a­bil­ity: SQLite de­vel­op­ment is un­der con­sis­tent de­vel­op­ment and proper test­ing is done be­fore launch­ing new ver­sions.

Fully­fea­tured: It con­tains all the query lan­guage fea­tures found in the SQL2 stan­dard.

SQL ex­ten­sions: SQLite pro­vides a num­ber of en­hance­ments to SQL, which are not nor­mally found in other data­base en­gines. These en­hance­ments in­clude the EX­PLAIN key­word and man­i­fest typ­ing. It also pro­vides state­ments like RE­PLACE and the ON CON­FLICT clause that al­lows for adding con­trol over the res­o­lu­tion of the con­straint con­flict. It also sup­ports the AT­TACH and DE­TACH com­mands.

Of­fi­cial web­site: https://www.sqlite.org/

Lat­est ver­sion: 3.22.0

ORMLite

Ob­ject Re­la­tional Map­ping Lite (ORMLite) fa­cil­i­tates sim­ple, light­weight Ob­ject Re­la­tional Map­ping (ORM) func­tion­al­ity for per­sist­ing Java ob­jects to SQL databases by avoid­ing the over­head of other ORMs. It sim­pli­fies com­pli­cated SQL op­er­a­tions via a flex­i­ble query builder and pro­vides pow­er­ful ab­stract Data­base Ac­cess Ob­ject (DAO) classes.

ORMLite sup­ports JDBC con­nec­tions to MySQL, Post­gres, H2, SQLite, Derby, HSQLDB and Mi­crosoft SQL Server, and can also be ex­tended to var­i­ous other databases. It sup­ports na­tive data­base calls on An­droid OS. ORMLite is bulkier than SQLite or Realm, but slower than both of them. It is re­garded as faster than other ORM based databases.

As there is no JDBC sup­port in An­droid OS, ORMLite makes di­rect calls to An­droid data­base APIs to ac­cess SQLite databases.

Fea­tures

Pro­vides a set of light­weight C# ex­ten­sion meth­ods around .NET Sys­tem.Data.* in­ter­faces.

High per­for­mance data­base with sup­port for in­dexes, text blobs, etc.

Sup­ports cross­plat­form mul­ti­ple databases like SQL Server, SQLite, MySQL, Post­greSQL and Fire­bird run­ning on both .NET and Mono plat­forms.

Auto gen­er­ates SQL to cre­ate and drop data­base ta­bles. Has pro­vi­sional sup­port for DB2, Or­a­cle, ODBC and Netezza.

Has pow­er­ful ab­stract Data­base Ac­cess Ob­ject (DAO) classes.

Of­fi­cial web­site: http://ormlite.com/

Lat­est ver­sion: 5.0

Berke­ley DB

Berke­ley DB is an open source, high per­for­mance, in­dus­try lead­ing em­bed­dable stor­age en­gine that pro­vides devel­op­ers a fast, re­li­able, lo­cal data­base with al­most zero ad­min­is­tra­tion. It was pri­mar­ily de­vel­oped by Sleep­y­cat Soft­ware but was ac­quired by Or­a­cle in 2006. Berke­ley DB is writ­ten in C lan­guage with API bind­ings for C++, C#, Java, Perl, PHP, Python, Ruby, Smalltalk, TCL and many other pro­gram­ming lan­guages. It pro­vides pow­er­ful APIs for many lan­guages in­clud­ing An­droid and iOS.

Berke­ley DB pro­vides pow­er­ful ro­bust data stor­age fea­tures like other tra­di­tional RDBMSs such as ACID trans­ac­tions, and re­cov­ery, lock­ing, multi­process and multi­thread­ing for high con­cur­rency, repli­ca­tion and hot and cold backup.

Or­a­cle Berke­ley DB: Berke­ley DB has pow­er­ful ar­chi­tec­ture, which is very sim­ple com­pared to other RDBMS soft­ware. Or­a­cle added sup­port for SQL in the 11g R2 re­lease based on the pop­u­lar SQLite API by in­clud­ing a ver­sion of SQLite in Berke­ley DB.

All the pow­er­ful fea­tures of SQLite are in­cluded with Berke­ley DB. As it in­cludes the fully­fea­tured SQL data­base en­gine, you can use JDBC, ODBC or any other com­pat­i­ble ac­cess layer as well.

Berke­ley DB is highly flex­i­ble, and you can use it across a plethora of ap­pli­ca­tions and as a re­place­ment for cus­tom, home­grown so­lu­tions. It pro­vides fast, re­li­able and scal­able per­sis­tence for ap­pli­ca­tions that need to store data lo­cally, run with­out in­ter­rup­tion and ac­cess data in a pre­dictable fash­ion.

Edi­tions

The fol­low­ing are the three edi­tions of Or­a­cle Berke­ley DB: Or­a­cle Berke­ley DB: Writ­ten in C. Cur­rent ver­sion: 6.2 Berke­ley DB Java Edi­tion: Writ­ten in Java. Cur­rent ver­sion: 7.5.11

Berke­ley DB XML: Writ­ten in C++. Cur­rent ver­sion: 6.1.4

Fea­tures

Data man­age­ment: Fine grained and con­fig­urable lock­ing for con­cur­rent sys­tems; se­quen­tial and in­dexed re­trieval; stores data in-mem­ory or on disk or a com­bi­na­tion of both; strong en­cryp­tion; li­brary for data man­age­ment to link em­bed­ded pro­cesses; and highly por­ta­ble.

Trans­ac­tions: ACID com­pli­ant, nested trans­ac­tions, dis­as­ter re­cov­ery op­tions, con­fig­urable graph, dead­lock de­tec­tion and log file archival.

Repli­ca­tion: Sin­gle and mul­ti­ple replica mod­els; de­layed client syn­chro­ni­sa­tion; scal­able to thou­sands of replica nodes; non­stop up­grades; and PAXOS­com­pli­ant elec­tion al­go­rithm.

De­ploy­ment: Cross­plat­form, bi­nary in­staller, open source and has a pow­er­ful ad­min­is­tra­tion.

Of­fi­cial web­site: http://www.or­a­cle.com/tech­net­work/data­base/ data­base­tech­nolo­gies/berke­leydb/over­view/in­dex.html

Lat­est ver­sion: Berke­ley DB 12Cr1 (12.1.6.2.32)

Ob­jec­tBox DB

Ob­jec­tBox DB, de­vel­oped by Green­robot, is an ob­jec­to­ri­ented em­bed­ded data­base and is re­garded as the best al­ter­na­tive to SQLite for mo­bile databases. It is spe­cially de­signed for mo­bile data­base man­age­ment and brings NoSQL Server tech­nol­ogy to mo­biles.

The guid­ing prin­ci­ple be­hind the Ob­jec­tBox DB de­sign is, ‘Less code is bet­ter code’, which means Ob­jec­tBox DB is easy to work with even for new­bies.

Ob­jec­tBox is a fully trans­ac­tional data­base and con­sists of all the ACID fea­tures. It is a su­per­fast mo­bile data­base that per­sists ob­jects and en­ables users to avoid repet­i­tive tasks, pro­vid­ing a sim­ple in­ter­face to data.

The Ob­jec­tBox data­base ex­ten­sions com­bine ad­vanced en­ter­prise ap­pli­ca­tion ca­pa­bil­i­ties — self­ad­just­ing con­nec­tion pool­ing, trans­ac­tion han­dling and RDB­to­XML map­pings — with a re­ally straight­for­ward o:XML in­ter­face.

Ob­jec­tBox DB is a fast, ob­ject­ori­ented mo­bile data­base for An­droid and Linux, and soon will sup­port iOS. It sup­ports JavaRx and Kotlin.

Fea­tures

Fast: It is ten times faster than SQLite and de­liv­ers the best per­for­mance.

Ob­ject API: It builds ob­jects from the ground up, i.e., there are no ORM, no SQLite, no rows and no col­umns. Pow­er­ful query builder: Sim­ple queries for ob­jects with con­sis­tent checks at the time of com­pi­la­tion. Cross­plat­form

Sim­ple thread­ing: Ob­jects re­turned by Ob­jec­tBox work in all threads with no strings at­tached.

DaoCom­pat li­brary: This is an add­on li­brary for greenDAO APIs for Ob­jec­tBox.

Sup­port: It has an ac­tive com­mu­nity with more than 150,000 ac­tive users, and a strong team for ac­tive beta, unit and fi­nal test­ing.

Of­fi­cial web­site: http://ob­jec­tbox.io

Lat­est ver­sion: 1.4.1

Realm DB

Realm DB (Real Mo­bile Data­base) is an open source data­base specif­i­cally de­signed for mo­bile de­vices from scratch, and is avail­able for var­i­ous plat­forms in­clud­ing Xa­marin and Re­act Na­tive.

It is server­less and cross­plat­form like SQLite. Data can be stored on the disk as well as in mem­ory.

The key dif­fer­ence be­tween Realm and ORMs is that the former is not an ab­strac­tion built on top of SQLite, but a whole new data­base en­gine. Rather than a re­la­tional model, it is based on an ob­ject store. Its core con­sists of a self­con­tained C++ li­brary. It cur­rently sup­ports An­droid, iOS (Ob­jec­tive­C and Swift), Xa­marin and Re­act Na­tive.

Realm is un­der ac­tive de­vel­op­ment and has been re­leas­ing up­dates pretty of­ten. The de­vel­op­ment team is very re­spon­sive on the data­base’s is­sue tracker and Stack­Over­flow.

Fea­tures

ƒ Easy­to­use: Realm is very easy to use com­pared to CoreData and SQLite. Realm data mod­els are de­fined us­ing tra­di­tional NSOb­ject­style classes with @prop­er­ties. You can sim­ply sub­class RLMOb­ject to cre­ate your

Realm data model ob­jects.

ƒ Faster re­sponse: Realm is faster than other databases like SQLite, FMDB, CoreData and Couch­base Lite in app data stor­age. Even com­plex queries take nano sec­onds, and stay up­to­date with new data.

ƒ Realm browser: This al­lows users to ex­plore and ad­min­is­ter realm databases.

ƒ Cross­plat­form: Avail­able for An­droid, iOS and other pop­u­lar mo­bile op­er­at­ing sys­tem plat­forms.

ƒ Data se­cu­rity: Pro­vides en­hanced se­cu­rity of data via trans­par­ent en­cryp­tion and de­cryp­tion.

ƒ Con­cur­rency: Realm han­dles con­cur­rency with MVCC ar­chi­tec­ture, and these views ‘au­to­mat­i­cally up­date’ when a trans­ac­tion is com­mit­ted from any thread. Sup­port: Realm is highly sup­ported via proper doc­u­men­ta­tion, the com­mu­nity and is al­ways up­dat­ing to the lat­est fea­tures. It sup­ports Ob­jec­tive­C as well as Swift, which sug­gests that this could be a long­term so­lu­tion for iOS devel­op­ers.

Of­fi­cial web­site: https://realm.io/

Lat­est ver­sion: 4.3.1

Couch­base Lite

Couch­base Lite is a fully­fea­tured open source NoSQL em­bed­ded JSON data­base de­signed for mo­bile de­vices.

Data in Couch­base Lite is stored as JSON doc­u­ments.

Each doc­u­ment may have one or more at­tach­ments, which are es­sen­tially un­in­ter­preted bi­nary data that is stored and loaded sep­a­rately from the doc­u­ment it­self. Couch­base

Lite sup­ports per­sis­tent in­dices (called views), and uses MapRe­duce to man­age and query them.

Couch­base Mo­bile is the so­lu­tion pro­vided by Couch­base Lite for mo­bile ap­pli­ca­tions. It com­prises three dif­fer­ent com­po­nents: Couch­base Lite, an em­bed­ded NoSQL data­base and Sync Gate­way. Couch­base is an off­line­first data­base, and syncs with the cloud when needed or when the net­work is avail­able. Couch­base Lite runs lo­cally on the de­vice and per­sists data as JSON and bi­nary for­mat. All CRUD op­er­a­tions are per­formed on the lo­cal data­base. Devel­op­ers do not need to write sync code (if needed) to sync the lo­cal data­base with the cloud, as this is han­dled by Sync Gate­way.

Couch­base Lite pro­vides na­tive APIs for An­droid and iOS with plug­ins for Xa­marin and PhoneGap.

Fea­tures

ƒ It is light­weight — just 500KB to 1MB.

ƒ Data is se­cured on the mo­bile de­vice us­ing 256­bit AES en­cryp­tion.

ƒ Syn­chro­ni­sa­tion of data is from de­vice-to-de­vice via a peer­to­peer net­work.

ƒ Con­tains both REST APIs and na­tive APIs for data man­age­ment.

ƒ Cross­plat­form sup­port avail­able for An­droid, Mac, Win­dows and Linux.

Of­fi­cial web­site: https://www.couch­base.com/prod­ucts/lite Lat­est ver­sion: 5.0

LevelDB

LevelDB is an open source data­base for mo­bile and Web apps, and was de­signed and de­vel­oped by Jef­frey Dean and San­jay Ghe­mawat of Google Inc. It is a sim­ple, key­value store data­base built by Google. It is cur­rently used in Google Chrome and other soft­ware. It sup­ports ar­bi­trary byte ar­rays as both val­ues and keys; sin­gu­lar put, get and delete op­er­a­tions; batched put and delete; and bi­di­rec­tional it­er­a­tors. Sim­ple com­pres­sion is per­formed us­ing the fast Snappy al­go­rithm.

LevelDB is not an SQL data­base and doesn’t have a re­la­tional data model. It doesn’t sup­port

SQL queries or in­dices. Ap­pli­ca­tions make use of LevelDB as a li­brary, and it doesn’t pro­vide a server or com­mand-line in­ter­face.

LevelDB is much bet­ter than SQLite and Ky­oto Cab­i­net in terms of read and write op­er­a­tions, and also the best in batch writes. It also per­forms bet­ter in terms of read, write and syn­chro­ni­sa­tion­based op­er­a­tions when com­pared to Berke­ley DB and OpenLDAP Light­ning DB.

LevelDB is writ­ten in C++. iOS devel­op­ers can use it di­rectly in their ap­pli­ca­tions or through one of the sev­eral Ob­jec­tive­C wrap­pers that are avail­able for it. An­droid devel­op­ers can use LevelDB via JNI and NDK.

Fea­tures

ƒ Makes mul­ti­ple op­er­a­tions atomic.

ƒ Creates con­sis­tent snap­shots.

ƒ Is it­er­a­tive over key ranges.

ƒ Of­fers au­to­matic data com­pres­sion us­ing the Snappy Com­pres­sion li­brary.

ƒ Ba­sic op­er­a­tions: Put (key, value), get (key) and delete (key)

ƒ Fa­cil­i­tates tran­sient snap­shots for a con­sis­tent view of the data

Of­fi­cial web­site: http://leveldb.org/

Lat­est ver­sion: 1.14

UnQLite

UnQLite is an open source em­bed­ded NoSQL data­base en­gine de­signed in 2012 by Mrad Chems Ed­dine and his col­leagues while work­ing on dis­trib­uted P2P and VoIP so­lu­tions like Skype. Its key­value stor­age op­er­a­tions are sim­i­lar to Berke­ley DB and Mon­goDB, and it has an in­built script­ing lan­guage called Jx9, which is like JavaScript.

The main de­sign ob­jec­tive of UnQLite is to store in­for­ma­tion of all nodes like the IP­ad­dress, blobs, etc. UnQLite was cre­ated by con­sid­er­ing SQLite3 as the back­end, i.e., the VFS layer, lock­ing mech­a­nism and Trans­ac­tion Man­ager with Jx9.

UnQLite ar­chi­tec­ture: UnQLite is suit­able for em­bed­ded de­vices and is writ­ten in ANSI C. It is thread safe, fully re­en­trant and com­piles un­mod­i­fied. It is avail­able for var­i­ous plat­forms like Win­dows, FreeBSD, So­laris, Mac and for mo­bile plat­forms.

Fea­tures

ƒJSON doc­u­ment store via Jx9

ƒFully ACID­com­pli­ant

ƒPlug­gable run­time in­ter­change­able stor­age en­gine ƒ Sim­ple, clean and easy­to­use API

ƒBSD li­censed

ƒKey­value store

ƒSup­ports ter­abyte­sized databases Of­fi­cial web­site: https://unqlite.org/ Lat­est ver­sion: 1.18

Fire­base

The Fire­base real­time data­base is cloud hosted. Data is stored as JSON and syn­chro­nised in real­time to ev­ery con­nected client. On build­ing cross­plat­form apps with iOS, An­droid and JavaScript, all clients share one real­time data­base in­stance and au­to­mat­i­cally re­ceive up­dates of new data.

Fea­tures

ƒReal­time, fast syn­chro­ni­sa­tion: Fire­base uses data syn­chro­ni­sa­tion—ev­ery time data changes, any con­nected de­vice re­ceives that up­date within mil­lisec­onds.

ƒOff­line ac­cess: Fire­base apps re­main re­spon­sive even when off­line be­cause the Fire­base SDK per­sists your data to disk. Once con­nec­tiv­ity is re­es­tab­lished, the client de­vice re­ceives any changes it missed, syn­chro­nis­ing it with the cur­rent server state.

ƒAc­ces­si­ble via client de­vices: The Fire­base re­al­time data­base can be ac­cessed di­rectly from a mo­bile de­vice or Web browser; there’s no need for an ap­pli­ca­tion server. Se­cu­rity and data val­i­da­tion are avail­able through its se­cu­rity rules, which are ex­pres­sion­based rules that are ex­e­cuted when data is read or writ­ten.

Of­fi­cial web­site: https://fire­base.google.com/

Fig­ure 2: UnQlite ar­chi­tec­ture

Newspapers in English

Newspapers from India

© PressReader. All rights reserved.