BLOGAnnounced at MongoDB.local NYC 2024: A recap of all announcements and updates — Learn more >

Compare

Comparing SQLite and Atlas Device SDK

Learn how SQLite and frameworks like Room and Core Data compare to Atlas Device SDK.
Deploy a sample app
View documentation
Overview

Modern applications today attempt to reach a global audience in a network-connected world. However, there is demand for local storage and database capabilities in many devices and processes. Those capabilities should be fast, reliable and eventually scalable when it comes to sharing and syncing information.

SQLite was initially developed to solve a local access SQL solution with relational concepts. Having said that, most of today's mobile development will most likely use one of the popular frameworks operating as an ORM (Object to Relational Mapping) for SQLite, like Room for Android or Core Data for iOS. These frameworks manage the entire object to data store life cycle, which is comparable to the capabilities of the database that Atlas Device SDKs provide.

What is SQLite?

SQLite is a C-based library that allows applications to store and retrieve data from local files on devices via a SQL interface. SQLite was started as an open-source project in September 2000 and It is supported on a few platforms, mostly mobile devices and mobile/desktop operating systems. However, it is maintained by a certain group of people and contribution is very limited and governed closely by the creators.

What are Core Data and Room?

Apple’s Core Data and Android Room are frameworks used to manage the lifecycle of objects in a mobile application which often use SQLite as a local/on-device data store. These frameworks provide a structured way for developers to ensure that the data passing through their application is always up to date and in the correct format for whichever part of the stack it is in. Examples of this include updating a datapoint in the UI when it changes in the underlying database, or converting data types between those used in front-end languages and ones supported in the underlying database.

What are Atlas Device SDKs?

Atlas Device SDKs provide a fast, scalable alternative to SQLite that makes storing, querying, and syncing data simple for modern mobile applications. The SDKs provide a database with an object-oriented data model, enabling developers to work directly with native objects – no ORMs or DAOs required. When paired with Atlas Device Sync, developers receive out-of-the-box edge-to-cloud data sync allowing for the easy backup, management, and analysis of mobile app data in the cloud, using the full power of MongoDB Atlas. The Atlas Device SDKs are open source and are available for most popular languages, frameworks, and platforms.

When to use SQLite for mobile applications

SQLite is a veteran in the mobile self-contained database world and therefore, developers with preference to SQL syntax with static schemas might prefer SQLite. However, as mentioned earlier, SQLite is usually not used on its own and will be a part of a Room or Core Data implementation. This added complexity and the need for an additional ORM layer will result in additional coding challenges and more dependencies introduced in your product.

With that said, offline-first and complex schema evolution with agile changes has become a wide challenge for lots of mobile applications and websites. Therefore, a majority of customers should consider the benefits of Atlas Device SDK’s modern solution over the legacy SQLite.

If you require a scalable solution with high concurrently and offline synchronization, SQLite (Room and/or Data) might not be enough for your needs.

SQLite (Room and Core Data) and Atlas Device SDK comparison

Let's look at a simple initial code snippets to query each one of the database implementations for data of Planet Earth:

Core Data Swift

Swift

Atlas Device SDK Swift

Swift

Room Android

Java

Core Data Swift

Java

As you can see Atlas Device SDK code is much lighter and method oriented. It allows object-oriented languages and frameworks to utilize it with method based access, unlike the Room and Core Data packages which use SQL strings and are susceptible to untidy code and SQL injections.

SQLite vs. Atlas Device SDK

Let's cover some key comparison points between SQL Lite + Room/Core Data and Atlas Device SDK & Device Sync on MongoDB Atlas.
Data Model

SQLite + Room/Core Data

Based on Relational tables with ORM concepts.

Objects need to be transformed and broken into row based stores.

Atlas Device SDK & Device Sync on MongoDB Atlas

Atlas Device SDK uses an object-oriented model. Objects in code do not need to undergo any transformation before being written to the database. This eliminates the need for an ORM layer and vastly enhances schema flexibility.


Query System

SQLite + Room/Core Data

Leans on SQL query syntax Room - Relies on the DAO concept, which requires queries to be predefined with respectful predictions. Core Data - Relies on a similar concept, called managed object contexts. The syntax varies slightly but it is functionally identical. SQLite as well as the frameworks will not have built-in reactive elements to refresh the UI upon changes. The developer will need to use coding or third-party frameworks to support that.

Atlas Device SDK & Device Sync on MongoDB Atlas

Atlas Device SDK uses an object-oriented model. Objects in code do not need to undergo any transformation before being written to the database. This eliminates the need for an ORM layer and vastly enhances schema flexibility.


Sync Services & Backup

SQLite + Room/Core Data

SQLite ORMs’ as well as SQLite do not provide any cross-device or offline-first sync capabilities. The data is managed on the device only.

Atlas Device SDK & Device Sync on MongoDB Atlas

Using Atlas Device SDK’s with Device Sync provide built-in sync capabilities, such as conflict resolution which is made possible by operational transformation, and takes care of network retry/error-handling. This keeps teams efficient by eliminating the need for developers to invent their own sync logic.

The offline-first methodology of the Atlas Device SDK means all changes are automatically persisted as fast as possible, with no further work from developers. This is accomplished by Atlas Device SDK always reading from its local copy first, before going over the network.

Atlas clusters have a full built-in backup strategy for snapshots and point-in-time recovery.


Security

SQLite + Room/Core Data

SQLite as well as the ORM’s do not provide user based management. The application needs to cover the security for the database.

Additionally, there is no native built in encryption and users need to use third-party encryption libraries.

Atlas Device SDK & Device Sync on MongoDB Atlas

Device Sync provides built-in authentication and authorization controls that make it simple to limit what fields are synced to a user’s device based on their role.

Device Sync complies with a number of strict security standards such as HIPAA, PCI, and SOC.

Atlas Device SDK’s client-side database provides native encryption.


Platform & Driver Support

SQLite + Room/Core Data

SQLite in conjunction with Room is built for Android applications, and Core Data is built for iOS based applications.

If you wish to develop cross-platform or additional web interfaces you will need to depend on your project on the different ORMs and concepts that each framework brings.

Atlas Device SDK & Device Sync on MongoDB Atlas

Idiomatic SDKs

are available for most common platforms and programming languages, with equally descriptive documentation and code examples for each.

Dedicated team of engineers to continuously improve and enrich documentation, examples, and platform support.

Conclusion

Atlas Device SDKs provide a modern and robust mobile database solution, which is superior to SQLite with Core Data and/or Room in many areas. It allows users to build cross-platform, offline-first applications backed by the entire MongoDB Atlas Device SDK and MongoDB Atlas cloud platform.

Try Atlas Device SDK now to build modern mobile data-driven applications. See the following tutorials and links for more information.

Deploy Atlas Device SDK in minutes

Deploy an iOS, Android, or cross-platform “To Do” app with real-time sync in minutes.
Get Started Now
An illustration of a database and device syncing over clouds.