Connecting a MySql database to an IOS application - mysql

Basically I need to connect a MySql database to an IOS application and save a local copy to the device but i'm confused about which path I should take to do this.
Here is a basic description of the application:
The application is used to replace multiple paper based forms, allowing the user to complete a desired form on an iPad. Once the user has completed the form, the forms data is uploaded to a server.
Some forms have fields where the user is required to 'select' an option (drop down list). These options need to be pulled from a database because the options will be changed regularly.
The application still needs to work if there is no internet connection!
This means that whenever there is a connection the application needs to save a copy of the current database so that any required information to fill out forms is still available even if there is no connection.
In short my question is: What is my best option to save a local copy of a database (or just a few tables) to an IOS application?

You should look into Core Data. If you're trying to keep an updated copy of a couple tables, I would create a Core Data database that contains the information you need for your app and, every time the user uses your app, check to see if there's an internet connection. If there is, use NSURLSession to download the necessary data from the web server, after which you can compare the downloaded data to that which is in your Core Data database. If there are any discrepancies between the two, you can update your Core Data database as needed. This way you will always have a relatively up-to-date copy of your MySQL database.
This is a good tutorial for getting a feel for NSURLSession in case you haven't used it much.
Hope it helps!

Related

Update access application file without changing the data

I just finished developing a Microsoft Access database application for a friend and he started entering data already.
He just contacted me that he would like to add additional features to the application (Nothing Major).
He is using his computer (to enter data) at one location and i use a different computer at a different location (to build the application). My Question is, is there a way when i finish updating my (empty) copy of the application to replace it with his copy of the application without effecting the data he entered into the database?
The real answer is to split the database into two: A backend with tables only, and a frontend with all forms, reports, etc.
There is a wizard that will do 99% of this for you.
When done, you can update the frontend at any time and relink the tables from the backend.

How to properly setup a MYSQL database with JAVAFX intellij?

Ok so Im am still very new to javafx and intellij. I am working on a little project of my own right now and all I am trying to build is a simple calendar just like apple's version or google's. I figured this would be a good exercise for me to get to know the Intellij IDE better and JavaFX.
Here is the problem that I seem to be stuck with for a couple days now. In my application, a user has the ability to create a new event which contains many properties such as "event name", "first name", "last name" etc.. Now all the information is stored in a shall we call it "NewEvent" Node. Here lies the problem I am facing. I am trying to save the data locally on the clients computer however I am not sure how to begin. I have browsed around and I have found this thing called MYSQL that is supposed to do just that. I was hoping you guys could help me out here on how I should set this up.
Here is what I've done so far.
Downloaded MYSQL v5.7
Downloaded MYSQLWorkbench
Created a Database called "event" with all the properties contained in the Node
Somehow added the MYSQL database to intellij
Created a dialog where if the user clicks save, all the information is stored in a node.
To my understanding in order to access the data stored in the MYSQL table, shouldnt the "data file" be saved in my project folder? I have no clue where this is located. Also how would I gain access to database in order to edit it dynamically. Like adding a new row to the database.
I have looked up online with many different searches but they all seem to be using NetBeans and they are mostly outdated. I found it really hard to find information from start to finish. All I want to do is to store data locally and to access it. I expect to have a largely populated database, seeing as no one actually deletes an event once its over so what I was told is that MYSQL is capable of handling huge data. Hence my choice to go along with it.
I have done a little Android Application last summer so I am a little familiar with MYSQL, however I remember saving the data onto a table on the clients phone.
MySQL isn't an embedded database. Only the libmysqld is embeddable.
You can integrate JavaFx application with any database. HSQLDB or H2 would be more appropriate, since they do not need an installation on the client machine, and can be configured to save the data file on any location.

Filemaker Pro and generating stats in html

I am using Filemaker pro 12 to manage a small database. What I need is to generate some stats based on the data in the database and update an HTML page so at any point I get updated stats. How would I do this ? I am a newbie when it comes to databases.
I am not necessarily sold on filemaker and if there is a better database option that has easier options available for autoupdating a website from the database, generate real time data etc. I am open to hearing about them. Thanks in advance for helping out.
If the FileMaker database is hosted using FileMaker server, you can output information from a FileMaker database to a web page using the FileMaker API for PHP. You just need to enable access via PHP in FileMaker server, and write the appropriate PHP code to pull out the data you want. You probably want the FileMaker server and the web server to be at the same location as there can be a bit of overhead going between them.
Advantage of the above is that it is real-time. However, if your web site is high traffic, it could bog down your FileMaker system.
Another way would be to build the web page using MySQL. FileMaker can access MySQL tables and then manipulate them almost as if they are local tables. You could have a script that periodically imports data into the MySQL table from the local tables. You could run the script as often as you want to keep the data up-to-date, but it wouldn't be as up-to-date as a live system. On the other hand, there wouldn't need to be a connection to the FileMaker database every time someone viewed your web page.
If you need something simpler and less current, you could write the entire page using FileMaker calculations, then manually export the field to an html file as required and manually upload it to the web server.
There are probably many other ways. You haven't been very specific in your requirements.

"Buffering" data entry into online form in case of disconnection (Racket)

My company has an existing framework for online medical data entry. We are now working with some doctors in China who are interested in using this framework, however they have some concerns.
On the technical side, the online data entry forms are written in Racket and saved into a MySQL database on a server in Europe after entry. Their concerns are that in some hospitals, Internet connection might be unstable and thus doctors might lose data that was just entered into a form.
So the question is, is there some possibility to somehow buffer the data offline on the respective doctor's workstation before attempting a save to the MySQL database, in order to reduce the risk of data loss. My first instinct was to answer no, because whatever measures the application might take, it's still a web application, so when the Internet connection breaks, there won't be any possibility on the application side to save the data.
Am I right with my guess or might there be a way of accomplishing this? Another idea was creating a completely new application used for data entry and just send the data to the database when data entry is complete; this is however not feasible for the scope of this project.
Thanks in advance!
You can create a local MySQL database, make all the data from the forms be inserted into this database an then when you're sure you have internet connection you export this data to the remote MySQL database, from a different GUI preferably.
Take a look at this page http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html and check if it helps.

Retrieve data from a MySQL database to be presented in an iPad app

I have an application for iPad that needs to be able to connect to a MySQL database to populate a table with information. The database is already set up however I do not know how to make the application populate the table view with the data from the MySQL Server. Do the cells in the table view have to be dynamic or can they be static? Im pretty new to iOS development so any help would be appreciated. Im starting fresh with a project so lets assume that i am starting with a View Controller that has a button, when pressed, goes through a navigation controller to display the table view controller.
I understand that the application cannot connect directly to the MySQL (information gathered from posts on this website) so a PHP file has been generated that updates as the data on the MySQL server updates.
Thanks
I used the following tutorial to learn how to parse data from my xml files into tables. It needed minor tweaking for XCode 4.2, but simple to do. I use XML files hosted on our site that are populated from our SQL servers daily. If you need more specific guidance, I'll be glad to provide it.
http://www.lonhosford.com/lonblog/2011/05/11/xcode-4-iphone-mountains-of-the-usa-tutorial-lesson-1-setup-the-app/