I have following scenario
I have Sqlite file of 4GB of data to support offline.
Can I copy to the app and distribute the app, does it affect
application performance.
I need to read data from the same sqlite file, can I use the native
sqlite commands to read from 4GB of sqlite file or can I run a
server like GCDWebServer to read data from sqlite file. Which
approach gives better performance.
There are many ios applications that access a local Sqlite database. I personally prefer to use FMDB as a library to access Sqlite. Since Sqlite is a C library, you can call the library directly from Swift or Objective-C. You should be able to find many tutorials on building Sqlite applications.
i used iTunes sharing functionality for accessing database from outside the app resources, with GCDWebServer to support offline tile rendering functionality.
Related
Is it possible to use mongoDB locally in an iOS app? Or do I have to convert the data to SQLlite?
MongoDB Realm is your solution!
check here
For local data storage on iOS device from your app you should consider CoreData as the recommended approach or go for SQLite. There is no mongodb for iOS.
Since you were looking at mongoDB, I would assume that you were looking at a NoSQL alternative and/or specifically a JSON based Document store for your local storage. In that case, as noted above, MongoDB does not have a local storage option for mobile apps.
You may want to look into Couchbase Mobile which includes Couchbase Lite which is NoSQL embedded storage for iOS, Android, Windows. Depending on your needs, you can use Couchbase Lite in standalone mode or you can sync your data to the cloud via Couchbase Sync gateway and persist data in the cloud using Couchbase Server.
Some other considerations to be factored into your choice of mobile database - platforms to be supported, type of data to be stored (structured, semi-structured, unstructured) - the importance of a schema/ data model, how frequently do you expect your data model to evolve - need for data migrations ,data sync capabilities among others
No, Mondodb is a DB storage system designed for backend enviroments. For iOS os recommended use CoreDate. But if you looking for storage NoSql, i recommend use Realm or CouchBase
Realm:
https://realm.io/
CouchBase:
https://developer.couchbase.com/documentation/mobile/current/installation/ios/index.html
This tecnologys can work with any API and you can storage values from any source.
I am working on an app that collects user data including photos. It's mandated that this app should work in offline mode - meaning that the user can complete surveys and take photos without an internet connection and that data should sync back to a remote database. How is this generally handled? Do I create a local database with Core Data and write an additional layer to manage saving/reading from a server? Are there any frameworks that help facilitate that syncing?
I have also been looking into backend services such as Firebase that include iOS SDKs that appear to handle a lot of the heavy lifting of offline support, but it does not appear to support offline syncing of image files through the Firebase Storage SDK.
Can anyone recommend the least painful way to handle this?
Couchbase Mobile / Couchbase Lite is probably the best solution I've come across so far.
It allows offline data storage including binary data, and online syncing with a CouchDB compatible server. It works best with their Couchbase Server / Sync Gateway combination, but if you don't need to use filtered replication or 'channels' (e.g. for syncing data specific to a single user with a shared database), you can use Cloudant which saves you having to set up your own server.
Its also available across most platforms.
Generally for images it is best to use NSFileManager and save your images in either the documents directory or the caches directory depending on the types of images you are storing. Core Data or Firebase are databases that are more qualified for data than images although they do support arbitrary data storage.
You can also try SDWebImage which has a lot of features around loading and storing images.
I'm considering using CouchBase Lite instead of CoreData for my OS X and iOS apps. However, I need to be sure whether I can sync the data between OS X and iOS apps via iCloud in case Couch Base Lite is used.
CoreData syncing is possible via iCloud. I hope it could be done for CouchBase Lite.
I don't know how CouchBase Lite writes data out, but your options with iCloud are Core Data, flat files, or NSUbiquitousKeyValueStore. If CouchBase Lite uses flat files, it should work, as long as you explicitly set every one of its files to be synced by iCloud and you can resolve any conflicting changes that might come up in those files. File sync over iCloud will sync files and notify you of conflicts, but resolving them is up to you.
Whether that makes it easy or difficult depends on the details of CouchBase Lite's data storage.
If you are going to go with CouchBase, you should sync via a CouchBase server. Sync is a strength of CouchBase, and it would be silly not to take advantage of it.
Trying to use CouchBase via iCloud sounds like a bag-of-hurt. It wasn't designed for that purpose.
If you want to stick with iCloud, you can use Apple's Core Data sync, or a third party framework. TICDS and Ensembles are both based on Core Data, and can sync via iCloud. (Disclosure: I have contributed to both projects.)
Couchbase Lite was made for sync compatability with Couchbase Server; however, for folks who want to continue to utilize a relationship between iCloud and the device, and thereby need Core Data, we do have a Core Data adapter that you could use as migration or symbiosis with Couchbase Lite. Some sample work is available here: https://github.com/couchbaselabs/cblite-coredata-sample-ios
The adapter itself you can see here: https://github.com/couchbase/couchbase-lite-ios/tree/1.0-beta3/Source/API/Extras
Jessica
I wish to create an application that will hold a large amount of heavy data (images and sound files) - I wish to avoid having a heavy app. I saw that there are apps that you download from app store and only after they are on your device they download from a server the rest of the files.
I already started reading about JSON and it seems quite clear, but I have never worked with servers before.
Can anyone direct me to a good tutorial that explains how to create my database on a server?
Maybe some recommandations to which servers and tools are available? - preferably free tools...
You can use phpMyAdmin and mySql (both free).
You can find all the info you need to install phpMyAdmin here :
http://www.phpmyadmin.net/documentation/
And you will learn all you need for basic sql here:
http://www.w3schools.com/sql/default.asp
I am using Delphi 7 and ZeosLib 6.6.6 to access SQLite3 database.
What is the best practice to use shared database.
I plan to put the database file (data.db3) in a shared location.
And the Delphi application is on local desktop computer of every users.
I want to know how to manage database locking for example. Detecting if the database is being locked by certain user, things like that.
Thanks.
SQlite3 handle database sharing by default, locally on the same computer. You have nothing to do, just open the database several times on your hard drive. Of course, it does have an overhead, and locking will make it slower than access from one unique process.
But if by "in a shared location" you mean a network drive, as your question suggests, it probably won't work as expected.
Locking files over a network are not safe (at least in Windows world). See http://www.sqlite.org/cvstrac/wiki?p=SqliteNetwork
You should instead rely on a true Client/Server approach, still possible with SQLite3 on the server, and Clients accessing to it via the network. See e.g. our RESTful server using JSON and several protocols.
You can put a SQLite database on a shared network resource. According to the SQLite documentation - that is not recommended. Main reason - SQLite cannot effectively manage locking on a shared resource.
If you need multi-user access to a SQLite database, then you may consider using middleware, like DataAbstract. As a driver for Data Abstract you can use our library AnyDAC. Some articles: Using SQLite with AnyDAC and Using Data Abstract with AnyDAC. In first article check "Connecting to SQLite database from Delphi application" for usage cases, including how to setup for concurrent access.