Synchronise local WebSQL/IndexedDB database with 'pre-built' database file? - google-chrome

Is there any plan to make it possible to download (or synchronise from) a 'pre-built' database file, so to speak, for use with a local web browser database like WebSQL or IndexedDB?
At the moment, to add or update a local database it's necessary to export or store data in a format such as XML or JSON, then get, parse and store the data.

I am under the impression that what you're looking for would be too much over-standardization on the browser side. As I understand it, IndexedDB is meant to be simple and robust enough for anyone to write JavaScript code that does the synchronization to your database server of choice.
In the meantime, you might take a look at these projects:
PouchDB - An implementation of CouchDB on top of IndexedDB. One of the premises is to offer the same synchronization (master-to-master) decentralized capabilities of CouchDB on the browser.
BrowserCouch - A similar project but using WebSQL as browser storage.

Related

Is mongoose capable of having pluggable backends other than MongoDB, like plain, old JSON files on the filesystem as a datastore?

We have a tool that is normally used on a server (in the cloud, behind the firewall, etc). It uses Mongoose with MongoDB.
We now need to use our tool as a standalone app on a laptop and want to reuse the code that uses Mongoose. We are considering the possibility of not requiring our customers to install MongoDB on each laptop. The tool on the laptop will run as a service, headless, and will be the only process touching the data that's stored via Mongoose.
Does Mongoose offer support for pluggable backends? Is there an embeddable Mongoose backend we can use? Storage via plain, old JSON text files would be fine, unless there's something better out there.
Thanks,
Matthew

How to exchange data between MySQL and Parse.com?

We plan to use a MySQL database as the backend for our (Java or Ruby on Rails) based web application. After completing the web application, we want to port the application to iOS and Android.
We want to be able to run the application in "native" mode - that is, if a network connection is not available to the smart-phone, the system should be able to store the data locally, and sync with the backend when the network connection becomes available.
The best kind of framework for this kind of syncing is a library/framework such as Parse.com.
The question to which we want an answer is: is it possible to exchange data between the web application data stored in MySQL, and the Parse.com data which is stored in a proprietary format on the Parse servers?
Answer to your question: It is indeed possible, but syncing data is an advanced topic.
However, you also state that you want to access the parse data when offline. As I understand it, you want Parse to handle the offline state, and then sync to MySQL when connection is back up. Parse does not offer functionality to store data offline, other than caching requests. You probably need another service for your specific needs.
I might have misunderstood the use case. If so, my alternate understanding would be that ALL data for the smart phones will be handled by parse: both offline and online, with syncing. The answer is still: parse does not offer this kind of functionality.

indexedDB in a Chrome App

I'm building a chrome app which requires a persistent and local database, which in this case can be either indexedDB or basic object storage. I have several questions before i begin developing the app:
Is it possible to persist indexedDB data after un-installation of the chrome app and chrome browser?
If the indexedDB file/data persist can i locate and view it?
If I can locate but can't view it, is it possible to change the location of the indexedDB file?
Can I store the indexedDB in a file located on desktop or any other custom location?
If I had these requirements, I see a couple of options that you might pursue
Write a simple database backed by the FileSystem API, and periodically lock the database and back up that file. This would be pretty cool because I don't know of anyone who has implemented a simple FileSystem API backed database, but I could see it being useful for other purposes.
Any edits to the database would be also made to a copy of the database stored on your backup server, and I would write functions that could import snapshots from your backup.
Simply write functions to export from your indexedDB to some format into a backup, and to import from the backup.
All options seem quite time consuming. It would be cool if when you create an indexedDB, you could specify an HTML FileSystem API entry file to back it, and that way you wouldn't have to do 1 or 2.
I agree that it seems like quite an oversight that an indexedDB is quite difficult to back up.
I am writing a basic browser only application. No back end server code at this time. So I also have storage requirements. But I am not doing backup. I am looking at pouchdb as a solution: http://pouchdb.com/
Everything is looking good so far. They also mention that they would work well with Google Apps.
http://pouchdb.com/faq.html#native_support
The nice thing is you could sync your pouchdb data with a server couchdb instance.
http://pouchdb.com/api.html#replication
http://pouchdb.com/api.html#sync
If you want to keep the application local to the browser with no server support you could backup the entire database by using a batch fetch.
http://pouchdb.com/api.html#batch_fetch
I would run the result through gzip before you put it on the filesystem.
I am currently attempting this very same thing. I am using the Chrome Sync File System Api (http://goo.gl/5q8Z9M), but running into some instances where my file (or its contents) is deleted. With this approach I am writing out a JSON object. Hope this helps.

MySQL and Core Data in iOS

I want to retrieve data from remote MySQL database and store the data in my iOS app (creating "local" database, so the information can still be accessed even though there is no connection). After doing some research, Apple's Core Data API seems to be the answer. However, it's using SQLite.
Can I use Core data with MySQL? If the answer is no, is there any way to develop "local" database other than Core Data? I tried looking for the answer, but no luck. This is the closest one that I can get, but I don't really understand the answer. I am new at iOS development, so any help is greatly appreciated.
Yes, you can use Core Data with MySQL if you like, but you need to write the persistent store functionality yourself, which is a fairly advanced undertaking. It doesn't seem to have any benefits though. I think it would be better to retrieve the data from the MySQL server, and then store it locally in Sqlite. MySQL requires a separate server so obviously it cannot be run locally on iOS anyway.
You cant use coredata with MySQL. Because CoreData is a local database inside the mobile and MySQL is WebServer database. So we cant combine them. Why you dont like CoreData? It is the most powerful and simple database for the mobile apps. I think CoreData suits for your purpose. If your data is something lightweight. Then you can use
Plist
http://hayageek.com/plist-tutorial/
http://www.theappcodeblog.com/2011/05/30/property-list-tutorial-using-plist-to-store-user-data/
NSCoder
http://www.raywenderlich.com/1914/nscoding-tutorial-for-ios-how-to-save-your-app-data
CoreData is the way to go. CoreData is build under SQLLite but it is a relational data base --> Object Oriented mapping which makes it really convenient.
There's a graphic editor which will allow you to define your CoreData model the way you require it.

Interface between CardDav server and MySQL database

My web app uses mysql to store contact data. I'd like to sync this data via carddav with mobile devices. I understand carddav is based on a file system, not a database. What software is available to act as an interface or wrapper to make the carddav server work with mysql? or other relational database?
You might want to take a look at Bedework.
Baikal just added this feature!!!
Most dav servers are file system based. If you use SabreDav you can build a virtual filesystem based on your own backend. Baikal is a project that uses sabredav, and a virtual file system. Until recently it stored its data in sqllite. Now it supports both mysql and sqlite.
Its still not 100% mature, but its a great starting point. Playing around with it, I have been able to create contacts directly in the DB (by uploading vcard blobs to a table) and then having them show on my ipad addressbook.
After evaluating many systems, ones built on sabredav like baikal tend to be the simplest to build on. Fruxx is something else you may also check out. Its a hosted system, but will soon have an api.
Last if you are looking for a very elaborate system, then take a look at tine20. It supports activesync (illegally in the usa), carddav, caldav, and has a decent extjs web ui. It natively stores contact information in its mysql store, which is nice since you can update a contact through a sql statement without having to build a vcf file. Where tine doesnt make sense is that it uses a bit more resources because of all the features it offers, and the complexity has ensured that it has a VERY complicated database schema. In other words, you are probably better off creating a rest api on the tine source code rather than doing bare sql inserts.
http://baikal-server.com/