I am doing offline DB connectivity in my page using HTML5 IndexedDB concepts.. But Initially, I want to fetch large datas to store it in my IndexedDb, so for that purpose, I am trying to sync Sql Server Data to my IndexedDb Datatbase but I didnt find any solution to do that.. Is there any way to do that, If so Pls help me.. thank you..
The W3C has announced that the Web SQL database is a deprecated local storage specification so web developer should not use this technology any more. indexeddb is an alternative for web SQL data base and more effective than older technologies.
IndexedDB is not a relational database with tables representing collections of rows and columns. This important and fundamental difference affects the way you design and build your applications.
Not slow like a database on a cheap server, even slower! Inserting a few hundred documents can take up several seconds. Time which can be critical for a fast page load.
In addition to Editor and Kristof answers, I would like to add few more things since I've worked on a similar solution.
IndexedDB
is a document-oriented database while SQL
is relational database which means that the you should convert your data to a object model before storing them locally IndexedDB
and trying to create joins. IndexedDB
should be used if you store different objects in the database or you have additional data for your main object (example list of articles in one table - article text in the second table).Next thing is data synchronization - this can get really complicated if you update the data on both sides (client & server). The main problem that you'll be facing in the data synchronization is the fact that you'll have one main SQL
database and a lot of local client databases.
Here are couple things you should also consider:
SQL
database. IndexedDB
works faster with smaller transactions. Chrome
you can access IndexedDB
from web-workers
and make parallel requests - this can really speed things up.This are just some facts you'll need to consider before you start implementing the solution, hope it helps.
From what I understand in your question, you are just using indexeddb like a cache layer in case the db goes done. What I would do is the following.
In case you are working online a save of your data should exist out af 2 actions. Saving to your service (SQL server) and save to your indexeddb.
In case when you are offline I would do 2 operation. On is still updating your indexeddb, but I would add an extra object store where you save all of your operation that have to be preformed on your service. Once back online, you can processes them one by one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With