Android and Database

what is a database (DB)?

A database is a data structure that stores organized information. Most databases contain multiple tables, which may each include several different fields so that it can be easily accessed, managed and updated.

which database should use in my application?

Its basically depends on your app needs. Whether you wanna store your data locally on smartphones or you want your app to access data from database which is located remotely on some web server.
Databases for mobiles need to be:

  1. Lightweight as storage is limited on mobile devices.
  2. No server requirement.
  3. In a form of the library with no or very limited dependency (embeddable) so that it can be used when needed
  4. Fast and secure.
  5. Easy to handle through code, and option to make it private or shared with other applications.
  6. Low memory and power 


  • SQLite


SQLite is relational Database, a lighter version of SQL for android mobile application. It is a library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. Without any separate server process, it embedded SQL database engine, unlike any other database.
SQLite supports all the relational databases and is open source compact library which is by default present in two main Mobile OS i.e. Android and iOS, and also supported by blackberry and Windows phone.

  • Realm DB

Realm is a relational database management system which is like conventional databases, data can be queried and filtered, interconnected, and persisted but also have objects which are live and fully reactive.
Realm DB is developed by Realm and designed for a run on mobile devices. Like SQLite, Realm is also serverless and cross-platform. It can be stored on disk as well as in memory.

  • ORMLite

ORMLite is a lighter version of Object Relational Mapping which provides some functionality for persisting Java objects to SQL databases.
ORMLite is using to simplify complicated SQL operations by providing flexibility for query builder.
ORMLite is helpful in large applications with complex queries because it handles “compiled” SQL statements for repetitive query tasks. It also has support for configuring of tables and supports native calls to Android SQLite database APIs.
  • Berkeley DB
Berkeley DB is an open source high performance embedded Database that allows us to handle data in different ways. It was developed by Sleepycat Software and acquired by Oracle in 2006. It provides API for languages including Android and iOS.
Berkeley DB can handle data in many different ways. It can be in a relational way like SQLite, or it can be in Key pair data as byte arrays and supports multiple data items for a single key.
  • Firebase
is the best online database for Android Studio, It helps to build rich, collaborative applications by allowing secure access to the database directly from client-side code. Data is persisted locally and even while offline, real-time events continue to fire, giving the end user a responsive experience. It is backed by Google and scales automatically, for even the largest apps.
Google’s Firebase lets you use:
  1. Database
  2. File Storage
  3. Detailed Crash Analytics
  4. Real-time Detailed Analytics
  5. AdMob (to earn money)
  6. Messaging
  7. Many other functions that you’ll need to create powerful Android/iOS apps and games

In the end, it totally depends on the need of user and feasibility for the application to choose which DB will fit in. But every mobile DataBase should fill most of the above-mentioned requirements if not all.

تعليقات

المشاركات الشائعة من هذه المدونة

Android and Encryption

Android login & signup pages