Cordova stores MySQL database and server files offline

274 views
Skip to first unread message

Redzwan Latif

unread,
Oct 21, 2016, 11:30:41 AM10/21/16
to phonegap

I've built an app that displays information from my hosting MySQL database.

This app will also display image which is also stored in the hosting.

The reason I'm using MySQL is because this whole project is originated from a website. Now we want to expand the project to mobile app.

So now I've already completed building the app which connects to the hosting MySQL Database using ajax. This ajax request data from a php file which is also stored in the hosting.

Now what I intend to do is, I want to display the data and images even when the app is offline.

Can anyone guide me through this? Really appreciate your help. Thank you

Rob Willett

unread,
Oct 21, 2016, 11:45:21 AM10/21/16
to phon...@googlegroups.com
You need to store the images etc in a database, MySQL does not run on
Cordova as it's a true client/server database.

The obvious thing would be to use SQLite and replicate part of the
MySQL database with SQLite.

Since we have no idea of the database size, the number of entries, the
database schema, the volumetrics, its difficult to say much more.

However if you are thinking about database syncing, think carefully as
there's lots of pitfalls, eg. just one of them is what happens if you
lose network connectivity on a database sync, whilst in the middle of
a very large transaction.

SQlite whilst powerful and very, very good does not have some of the
features of MySQL but that probably won't matter.

You need to start reading about how to make async calls to your
database to get data, you need to look at what you need to store and
design your database schema accordingly.

Questions to consider:

1. What are you going to do about referential integrity?
2. What kind of images and how big are they?
3. Whats their encoding, if you use base64 encoding they could be large.
4. Can you extract your data in chunks from your MySQL database?
5. What happens when the network fails?
6. What happens when you run out of space?
7. Do you even need a relational database? Many, many times a
relational database is overkill.
8. Do you know JavaScript?
9. Do you know Angular?

Start reading and thinking as there's no substitute for understanding
what you are trying to do.

Rob

On 10/21/16, Redzwan Latif <redzwa...@gmail.com> wrote:
>
>
> I've built an app that displays information from my hosting MySQL database.
>
>
> This app will also display image which is also stored in the hosting.
>
> The reason I'm using MySQL is because this whole project is originated from
>
> a website. Now we want to expand the project to mobile app.
>
> So now I've already completed building the app which connects to the
> hosting MySQL Database using *ajax*. This *ajax request data from a php
> file* which is also *stored in the hosting*.
>
> Now what I intend to do is, I want to display the data and images even when
>
> the app is offline.
>
> Can anyone guide me through this? Really appreciate your help. Thank you
>
> --
> -- You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
> ---
> You received this message because you are subscribed to the Google Groups
> "phonegap" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to phonegap+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

Haizad Annuar

unread,
Nov 12, 2016, 11:38:43 AM11/12/16
to phonegap
Hi. Salam, pardon me. I read your post on how to store cordova/phonegap server offline.. but  I don't go that far yet. Actually I am totally loss on how to connect to hosting MySQL Database using ajax.. I do follow some tutorials , but it does not seems working. I hope you can guide me or show the steps on using ajax to call php in server so that I can edit/add/delete data from database by phone..

Thank you so much.
regards,
Haizad

Steve Husting

unread,
Nov 14, 2016, 10:36:53 AM11/14/16
to phonegap
Your question is not really about Cordova, but programming. It would be best to ask your question at Sitepoint.com or similar site for database questions like this.

James Henderson

unread,
Nov 15, 2016, 4:25:16 AM11/15/16
to phon...@googlegroups.com
Use IndexedDB - not SQLite

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
---
You received this message because you are subscribed to the Google Groups "phonegap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phonegap+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages