egoselfaxis
asked on
Seeking the best client-side database for a web-based application that can be manipulated using JavaScript
I've been researching this for some time now, and what I've concluded is that my 3 main choices for client-side databases for web-based applications (that can be manipulated using JavaScript) are the following:
1) Web SQL
2) IndexedDB
3) localStorage
I supposed that Web SQL is out of the question since it's now deprecated -- so strike that I guess. That leaves me with IndexedDB and localStorage .. (unless some other new DB type is looming on the horizon that I'm unaware of).
I'm a big fan of localStorage, and have already found some suitable libraries for simplifying the setting and getting of data. However, what seems to be lacking is the ability to have have multiple tables, each with it's own sets of columns, and auto-incrementing primary keys, etc (ie: like you can do with MySQL). Or am I mistaken about that?
Anyways, .. I'm trying to find the best client-side DB solution for a project that I'm working on .. a budget manager application that allows me to track income and expenses and perform calculations against them, etc.
Is there any way that I can use localStorage in the manner I've described (ie: multiple tables with auto-incrementing primary keys, etc)? If so, are there any special libraries they I should use that would simplify things (jQuery-based or otherwise)?
Or should I use IndexedDB for this? And are there any special libraries available that I can use to that would simplify things (jQuery-based or otherwise)?
Or is there something brand spanking new that I should be enlightened about? If so, .. what is it, ... where can I find it, ... and how do I use it?
Thanks!
- Yvan
1) Web SQL
2) IndexedDB
3) localStorage
I supposed that Web SQL is out of the question since it's now deprecated -- so strike that I guess. That leaves me with IndexedDB and localStorage .. (unless some other new DB type is looming on the horizon that I'm unaware of).
I'm a big fan of localStorage, and have already found some suitable libraries for simplifying the setting and getting of data. However, what seems to be lacking is the ability to have have multiple tables, each with it's own sets of columns, and auto-incrementing primary keys, etc (ie: like you can do with MySQL). Or am I mistaken about that?
Anyways, .. I'm trying to find the best client-side DB solution for a project that I'm working on .. a budget manager application that allows me to track income and expenses and perform calculations against them, etc.
Is there any way that I can use localStorage in the manner I've described (ie: multiple tables with auto-incrementing primary keys, etc)? If so, are there any special libraries they I should use that would simplify things (jQuery-based or otherwise)?
Or should I use IndexedDB for this? And are there any special libraries available that I can use to that would simplify things (jQuery-based or otherwise)?
Or is there something brand spanking new that I should be enlightened about? If so, .. what is it, ... where can I find it, ... and how do I use it?
Thanks!
- Yvan
localStorage is a simple key value store. You can store objects as JSON strings but there is no indexing or queries you can only fetch data by its key.
If you go this route one option might be to look at something like Redux. You create an object store for all your data where each data item is a path that traverses the object tree. Redux will then manage the store and ensure that it is not violated. You can persist the entire store as a JSON string to a localStorage key and read it on page load and write it when there are changes.
If you have to have a traditional database structure - although I can't imagine a use case where this is necessary over an object store as mentioned above - then indexedDB is probably the way to go - but it is quite a complicated API so I would only use it if the localStorage solution just does not fit.
If you go this route one option might be to look at something like Redux. You create an object store for all your data where each data item is a path that traverses the object tree. Redux will then manage the store and ensure that it is not violated. You can persist the entire store as a JSON string to a localStorage key and read it on page load and write it when there are changes.
If you have to have a traditional database structure - although I can't imagine a use case where this is necessary over an object store as mentioned above - then indexedDB is probably the way to go - but it is quite a complicated API so I would only use it if the localStorage solution just does not fit.
Filemaker is used by many people. A 30 day trial allows testing.
Soliant has recently published a library.
This is the second in the series of posts about the Web Viewer Integrations Library.
http://www.soliantconsulting.com/blog/2016/12/web-viewer-integrations-library-data-structure
http://www.filemakerprogurus.com/webviewer-integrations-library-complete-cs-education-39-stop-procrastinating/
I don't think you'll find a better way to get into using Javascript, jQuery, HTML, and CSS with FileMaker than this resource. Follow the link below to see the other blog posts (with videos) in the series and to download the free example files.
Remember, the future belongs to those who seize it. And integrating FileMaker with the web (and web services) is the future.
Soliant has recently published a library.
This is the second in the series of posts about the Web Viewer Integrations Library.
http://www.soliantconsulting.com/blog/2016/12/web-viewer-integrations-library-data-structure
http://www.filemakerprogurus.com/webviewer-integrations-library-complete-cs-education-39-stop-procrastinating/
I don't think you'll find a better way to get into using Javascript, jQuery, HTML, and CSS with FileMaker than this resource. Follow the link below to see the other blog posts (with videos) in the series and to download the free example files.
Remember, the future belongs to those who seize it. And integrating FileMaker with the web (and web services) is the future.
ASKER
Julian -- I'm definitely leaning towards using localStorage for my app .. despite it's limitations. But is there any way for me to use jQuery with Redux? I ask because I'm reluctant to spend more trying to wrap my head around the new SPA javascript frameworks (like React and Angular.js, etc).
Thanks,
- Yvan
Thanks,
- Yvan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for this Julian! I'm going to need to take a bit more time to figure out what exactly this code snippet is demonstrating (the data doesn't persist upon a page refresh as I'd expected) .. but I'm sure I'll eventually experience that "Ah hah!" moment.
Thanks again!
- Yvan
Thanks again!
- Yvan
ASKER
Sorry Julian -- I thought I had closed this one out and awarded points several weeks ago.
No problem - good luck with it.
Have you read the html5 rocks article on this topic? I found it a good read.
https://www.html5rocks.com