Databases on the backend system

For many decades I have always used a relational database on the backend system but… it’s not true anymore.

Imagine a service where the customer can update some information using a web application and that he wants to publish them when everything has been updated or at a scheduled time.

To manage these case the web application has the button ‘Publish to mobile devices’ that creates the data that the mobile device will download. In the past I created CSV files, XML files, SQLite database that the device will download and then use in the  offline App. This solution has worked well and it’s perfect for WiFi connections. The problem arises when the data to download are big and there is only a phone data connection.

In the past there were one option available with SQL Server and SQL Server Compact Edition: the automatic syncronization of the database. Unfortunately at that time I was using Oracle and MySQL and there were no options for these databases. Over the time there were proprietary solutions from many software house to sync the database but they were proprietary, expensive and not so popular.

Today there are new options available, they are open source, and not complicate to implement. I’m talking about Couchbase database, a NoSQL database available for free (Community edition) and with support (Enterprise edition) that has the module Couchbase Sync Gateway to allow the sync from mobile devices. When the user presses the ‘Publish to mobile devices’ there is a sync process from the data in the relational database and the data in the NoSQL database; at that point each device can sync the content of the database working on the differences of the mobile database and the server NoSQL database. This solution reduces the use of bandwidth, and it allows to create offline apps.

For the native and hybrid Apps the developer can use Couchbase Lite or PouchDB, and the sync is done with only a couple of lines of code.

The drawback ? The first start of the App might take lot of time to align the databases, and the second is that the database contains data in JSON format (but I think this is not a big problem, isn’t it ?)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s