Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What database to use with PhoneGap

I am creating my first mobile app using Phonegap and I am not sure what database to use with it. I have read a few articles and am finding it hard to decide on which is best to use. Two of the ones mentioned most seem to be MongoDB or SQLite

Because PhoneGap needs Nodejs, I thought that MongoDB would be a good option but is that too robust? I am familar with Mongo but don't want to choose it just because it is convenient, I would prefer to use what is best.

The app will hopefully store information both locally and on the server. Will probably be information like you would store for a messaging app - user info, contacts, messages etc.

Anyone know which would be best to use? - or if another would suit my needs more?

like image 265
lk1234 Avatar asked Dec 15 '25 07:12

lk1234


2 Answers

The phonegap is a framework that allows you to create mobile applications using API's multi-platform web. The choice of the database in my view should not be given by the framework, but for what kind of application you are doing.

I see three ways to store data from your mobile application.

1: Local Storage (http://www.w3schools.com/html/html5_webstorage.asp)

2: SQLite (https://github.com/brodysoft/Cordova-SQLitePlugin)

3: Database on server (can be anyone.)

The choice will depend on what you want from your application. If it is a simple application that will be stored few data, use the local storage of html5 that stores documents. If your application is already a bit bigger and more complex, you can use SQLite implemented in the browser using HTML5 which is supported by most current mobiles browser. The advantage here is that access to the base is done without the need to build a server. In the third case your application would be the type client server, in which case you should use the database on the server. The choice of database can be what you feel is appropriate.

like image 111
Leonardo Delfino Avatar answered Dec 16 '25 23:12

Leonardo Delfino


I suggest you go with IndexedDB if you want to store a lot of data in the client or LocalStorage which is able to store 5MB worth JSON data.
This is just the front end but for the back-end there are so many to choose from and if you plan to write the back-end with Node then it will be wise to use MongoDB.

like image 33
Adi Avatar answered Dec 16 '25 23:12

Adi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!