How to get any update from Mysql to SQLite in iphone - iphone

I have to download only updated data from my mysql database that I have created at server.
i also have SQLite database for iphone .
Now i want any changes in database would prompt the user for doing updating.
Also an update button will be there for updating.
how to identify the data is updated in the database.
Also is there any code for synchronizing will be good for understanding

You might want to take a look at objective sync = it provides synchronisation and integration between a local sqlite db on ithe iPhone and a RESTful web application (the interface to your Mysql DB on the server).

How else does the app communicate with the server? Why not have the app ping the server to find out if the MySQL DB is updated? Can the app check email outside of the iPhone's email client? You could generate a userID for each app User, and whenever changes are made to the MySQL server, it sends an email to the app telling it updates are available. There may even be a way to do this via something like XMPP/Jabber.
Essentially, the app has to talk to the server to get the updates regardless of how it finds out if there are updates. So that means it talks to the server in general. If that's the case, just have the server send the app an alert that there are messages. If you want the server to "push" this alert to the phone, you'll have to figure out what push methods you have available in iPhone apps.
But once you know how the server will alert the user/app/phone, you can eliminate the user's need to hit an update button, and just have the app replace the sqlite file with the updated sqlite file from the server. Since the sqlite file just reflects what is in the MySQL DB, you can avoid the headache of updating the app's file by just replacing it with an updated version.

Related

Can I pre-cache data to work offline in mobile app using AppSync?

I am developing an Android and iOS app that could be used in areas that have a very poor or no data connection. It is a requirement for the app to be pre-loaded with all of the data so it will work even if the app never communicated with the server, but it also needs to be able to update and sync when a connection is made. Is it possible to manually populate the AppSync (Apollo) cache database with data on launch and query and mutate it later? The app also contains several search and filter queries. Our backend API is currently using GraphQL.
I have seen this question, Is it possible to build offline-first mobile apps using AWS AppSync?, but it is a little different that what I'm asking.
The recommendation would be to hydrate (read: pre-load with data) a local SQLite database after install. SQLite is what the 'local cache' uses to persist data on the device.
Refer to this github issue for a code example of how to do this:
https://github.com/awslabs/aws-mobile-appsync-sdk-js/issues/160

Accessing Database using node.js in iOS

I want to create such a application in which my iPhone will have the UI for entering the data for the employees. After clicking on the post button data should be saved on the sqlite database and I also want to retrieve the data on button click from the database. I want to use node.js for communicating between my iOS app and the database. Since I have never used node.js before, please give me some links where I can study the sample applications.
I am not an iOS developer but I would make a REST service in Node.js that can sit between your Iphone app and your database. You most likely are going to want to have some form of authentication on the service.
Also does it have to be sqlite? There are databases that can understand HTTP. If you use CouchDB (there are others) you can let your app talk directly to your database. That means you can leave out Node.js completely. You can go even further and use a service that will provide a back-end for you. Something like parse.com (there are others) will do this for you.

How to connect iphone app to mysql data base

I have an application that has login screen and it will get user name and password first then whenever application will start, username and password will be checked from data base and after that i need some data to be fetched from database and display in iphone application. So how to integrate mysql data base with iphone app?
you can go through the tutorial for this
raywenderlich provided a great tutorial for this.
Check this
http://dblog.com.au/iphone-development-tutorials/iphone-sdk-tutorial-reading-data-from-a-sqlite-database/
tutorial for connectivity with sqlite.
You will not be able to connect to MySQL directly from the iPhone. You must use some intermediate layer such as a Web application with PHP.
So, you will have something like this:
iPhone POSTING a request to the WebServer using HTTP Web Server connecting to the MySQL database Web Server returning data to the iPhone (XML, plain text) iPhone processing the data You can use this technique to query and insert/update/delete data.
Once i found this library
http://www.eval-art.com/2008/09/05/libmysqlclient-for-iphone-2/
for mysql, and i dont aware how it works.

Need iOS Database Cloud Design Tips

I have an app that uses an SQLite database. With the advent of iCloud on the rise I'm trying to figure out a good architecture for syncing data between devices. So lets say my app runs on an iPhone, an iPad, and a Mac. How can I keep data in my DB up-to-date on all devices?
My first thought was, I can put the database in the cloud and send transactions. But the device may not always been online and the users need their content at anytime, so that wont work. My other thought was to continue using the local db, and then when a connection is made, to send the cached data to the central db. The problem is I have no ideal where to even begin on something like that. How would I know which data has been sent and not sent, which data to actually send when a connection is made, etc.
So this is my question (we don't have to get into iCloud specifics), using an SQLite database and iCloud (or any storage medium), how can I sync data between multiple devices, but still have the most recent data stored locally on the device?
You might want to checkout Couchbase Mobile. This would help with the synchronization you are looking for.
If you have a significant investment into CoreData, then you may want to look at writing your own NSIncrementalStore to support writing data to and from a key value store.
iCloud is only going to be a good solution if your data is sandboxed to a specific user. If you have multiple users that want to view the same data then it won't work.

How to store/retrieve application data incase application deleted accidentally

I am having an application in which I am having SQlite database too ..If I delete that Application accidentally. Is there any way to get back the same application with the same database.
Or Is there any way to keep database alone in a separate place inside iPhone memory so that we can recover after application delete if needed.
Please tell me how to achieve the above?.
Regards,
V.K.
Every iPhone app runs in a "Sandbox", which is where it stores its application files and databases. When you delete the app, the whole sandbox is deleted, including your SQLlite database. There is no way to write it outside of the sandbox short of having another app that listens on a URL and having the app in question write to that URL.