Nativescript Offline Data - sql

I'm quite new to NativeScript so I'm after some advice.
I've been looking at different back-end database solutions for the data. I've looked at firebase and while it does what it says on the tin I've come from am SQL relationship database background historically.
I've had a look and see that kinvey can connect to azure database (haven't tested this as yet)
I've looked at the azure database plugin but at present that doesn't support offline data.
Just wondering what other people have tried and recommend/stay away from.

Your use plugin nativescript-sqlite.

Related

Offline database in Expo

My users will be storing 10-500 records locally. I'm looking for a database with an offline-first approach that works with Expo.
Eventually the user will have the option to sync the data to an (undecided) online service. Looking for suggestions for this as well.
Users should be able to register an account to use online functionality such as syncing their data, uploading photos and viewing other users content. Offline functionality should work even without an account.
What are your suggestions for a database layer and the stack in general? Hoping to hear your suggestions.
As mentioned by Bruno Eduardo on the comments Expo comes with sqlite.
An example:
You import SQLite from expo:
import { SQLite } from 'expo';
You then can initiate a database like so:
const db = SQLite.openDatabase('db.db');
This would create the database in the local users phone.
From there you can query the tables you'd like to create and load with data like so.
db.transaction(tx => {
tx.executeSql('create table if not exists users (id integer);')
});
There are two approaches you can take (probably more but just two I'm thinking of).
You can query the data from an api so that it'll load it locally. Or the other option would be to copy a database with your data already setup to the device.
I need to mention there's a few problems with your approach. Best practice for many reasons, which I won't mention, is to use an api for data. If you're dealing with simple records the time to query an api is minimal. If the user is "Eventually the user will have the option to sync the data" then it might be best to consider working that out before you begin to build a local db.

Using Realm for Xamarin Forms with a preexisting SQL database?

We have a preexisting SQL database that holds our data and will be updated from time to time. I've just stumbled across Realm and don't quite understand how it works at the moment.
From the examples I've seen it looks as if Realm creates the database locally on the mobile device (please correct me if I'm wrong). This is not what we want. We want our data to live on some server and then pull that into the application.
Can this be done purely with Realm? Or should we somehow pull from the SQL server? What's the best way to achieve this?
Thanks!

how to have database offline for iOS app

I would like to develop dictionary app for iOS application. and I am not sure which database Managment system should I use to store data. I want to my app to be offline so even user that don't have internet, they still can use my app. so my question which database should I use to store my database ? I research on google, it said sqlite. so if i store my data in sqlite so will my data in database sqllite will go with my app? thank
Yes, sqlite is your DB of choice unless you're just working with a couple of dozen records.
If you plan to use CoreData, you can also address sqlite with it.
If you don't plan to use CoreData, you can still use sqlite and work directly with the DB. There are good wrappers which help you, like FMDB: https://github.com/ccgus/fmdb

Using offline storage

I am trying to make a website which will store all the contacts of the user on the server database. The user can add, edit, delete or update a contact. I want the user to be able to do all these functionality even when he is offline. What should I use to achieve this. I came across web sql database which can be use to store database offline. But I dont know how to synchronise the online and offline database. I am using Ruby on Rails
According to Web SQL's W3C page, the specification is no longer in active maintenance and the Web Applications Working Group does not intend to maintain it further (http://www.w3.org/TR/webdatabase/).
Why don't you give HTML5's persistent storage a try instead? There's a great tutorial here that also features a chapter on local storage hacks before HTML5, so you may read it if you're not planning to dive into HTML5 just yet.
You may also try Google Gears, as it features an interface to a local sqlite3 database in which you may store your offline data.
As for the synchronization mechanism try persistanceJS. It should help you with both HTML5 and Google Gears options.
EDIT
Apparently persistanceJS has no support for rails just yet, but there's a tutorial on how to use local HTML5 storage with rails here, and there's a rails plugin to easily enable gears on rails apps here. Those should get you started.
You can use Ruby on Rails to do it as well. Check out the Railscast series of video tutorials. Specifically episode 247 to get started with ROR and offline storage

Does Anyone Have Experience Creating an Occasionally-Connected Browser App With NHibernate?

We need to make our enterprise ASP.NET/NHibernate browser-based application able to function when connected to or disconnected from the customer's server. Has anyone done this? If so, how did you do it? (Technology, architecture, etc.)
Background:
We develop and sell an enterprise browser-based application used by construction field personnel to enter timesheet information. Currently, it requires a connection to the server back in the customer's office and we'd like to build an occasionally-connected version of the application for those clients without wireless Internet availability.
Our application is an ASP.NET application using NHibernate for O/R mapping. Being a Microsoft shop, the Microsoft Sync Framework is attractive, but we don't know whether it "plays well" with NHibernate.
Any insight would be greatly appreciated.
Dave T
Maybe you could operate some kind of offline version using a small version database (I hear good things about vistadb - http://www.vistadb.net/ which I believe does play well with NHibernate). With a syncing tool to copy data in when they are back on line. A click-once launcher could handle installation and integration.
Want to be careful with anything involving syncing though - if it is just single user timesheets that might be OK - but if there are any chances of conflicts in the online-offline data you might be better considering the problem from a different angle for pain-avoidance...
Why not couple it with Google Gears? People put their data in while offline, and then they can sync it when they reconnect to the server.
In a modern world, using the HTML5 data store:
http://www.webreference.com/authoring/languages/html/HTML5-Client-Side/