how to match a server database with with local database for iphone application - iphone

hi friend
can any one tell me that i have web server there i have create the database for store some value for registration form the value was save in webserver this is working good.
but now that data coming in json format and now i have fetch json value and save in to the local database which is same as the webserver database both the side same table and same colume name is there how can i do this in iphone application special for login page and other data also.
and how to write the query for this sitution help me friend

you can'nt match the local & remote database by using sql query,
you need to fetch the remote data using WEB API's then compare with your local database (local data will be accessed through sql query ).

Related

symfony users connexion with other database

I would like my login form to fetch if the user exists from another external database
example: from the site: test1.com/login
fetches if the user exists from the test2.com database.
I tried to set up the multiple connection but I did not find another solution to my problem

How to manage user database which is present in a single database among multiple applications

We have user data which is present in a single mongoDB. Multiple applications are using this database for user authentication.
The current method for the authentication is when the user signs in any application for the first time, data is fetched from parentDB and saved it respective local application db. The flaw with this method is when the user gets altered in parentDB, local copy needs to be synced.
Another method that we tried was writing the model definition in all the applications and connecting to parentDB of which the flaw is changing the model definition in all the applications if their is any change
What would be the suggested method for maintaining such user management ?
I would move authentication to separate server connected to parent db, and make all user management also request authentication server. Can also proxy authentication from app server to authentication server, so from outside it still looks like each app has its own auth.

couchDB / pouchDB / IONIC best practice

I want to create an app with IONIC to manage buildings. A user can hold multiple buildings. Each building has rooms. Each rooms has logs. Each user is a member of a cooperation.
For many years I've used LAMP. Now moving to mobile and made some IONIC apps. With 2 apps I've used sqlLite as datastore on the mobile device.
But now I've read up on couchDB and pouchDB and really like the concept and the sync option. So now I'm looking into this to use as my datastore (on the mobile and also on the backend).
Now I've got 2 major questions/concerns:
1) Authentication
In my LAMP situation, I usually have an SESSION (table which holds the sessions strings and userID) and an USERS table.
When the user logs in, the user is lookup in the USERS table, and a session string is created and saved with the userID.
Now each time a request is made to the server (for example update data), the session string is also supplied and matched to the SESSION table and retrieve the correct user. From that point on, I can validate if the post is valid and the data also belongs to the correct user.
Back to couchDB, I know there is a cookie management in couchDB (http://guide.couchdb.org/editions/1/en/security.html).
So here I can validate if an user exists and validate the credentials. Now the app can send requests with a cookie.
2) Fetch/Update the right data
In my LAMP situation, I always knew which data belongs to which user. And the back end always checks if this is correct.
In my couchDB I want to create database and each document is an user with all the data.
So now here comes the problem. I can validate an user in couchDB, put there's no way to validate the data (at least as far I know of) that it belongs to the right user.
My goal is that the mobile device syncs the document to the couchDB server.
3) Database structure
At first I wanted to create a database per user. But this is not scalable. Also an user is an member of a cooperation. I also need to generate reports per cooperation/user.
So now I was thinking to create a database per cooperation. But now the problem is, when a user login, I need to know wich database to connect to lookup the user data.
Now I want to use 1 database and each document is an user and holds al data (buildings/logs).
Has anybody got some other suggestions/resources on this approach?
You can try couchdb in combination with superlogin:
SuperLogin is a full-featured NodeJS/Express user authentication solution for APIs and Single Page Apps (SPA) using CouchDB or Cloudant.
github
Tutorial

Mongo DB and hashed password. Using the same database on another node application

I have a web application currently running with a database. The database stores the password as hashed(salt and hash). How do i use the same database on another application? Will the existing users on the other application able to login to new application?
Yes one can use same database provided the schema requirements are same. Also on updating user profile , the changes will reflect on both application using it .

Next step for updating iphone database from web server?

I have an iphone app with an SQLite db. I also have a MySQL database on a web server that the app will call to get new records on app start up. I created a web service that will receive the date of latest record in the app database and do the query to pull all the new records. The new records will be put into an array and JSON encoded to go back to the app.
Do I then put the new records into NSDictionary and write them to the app's SQLite database?
Yes when you received results from API in JSON you need to create NSDictionay or NSArray to do this you've to need JSON parser for iOS. After parsing the JSON you can insert it into your SQLite DB.