Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone App using Online Database

Database manipulation and functionality is almost entirely new to me. I'm in the midst of learning SQL(lite too) for usage in iPhone application data storage and its all very confusing at the moment, but with due diligence I will persevere.

My question is as such:

I would love to make an app that has profiles for users to log into an customize certain attributes in. Say for instance Jeremy from Alaska likes fishing, I would make Jeremy a "Person" object and fill his profile in accordingly. When he quits the app his data gets cached to disk and this is all easy to do, but what about if Jeremy from Alaska expects this app he is using inputs his information to an online server where he can access the information from say... a web browser? Basically what my question boils down to is HOW in the world do online databases work? Does Jeremy's app upload his information to a SQL server somewhere? (Are there better ways?). What exactly happens when he types his user name and password into the application? Does this instantiate a query of sorts to a database including the username/password information? And what kind of software handles and processes this query?

How, in its most basic concept, do I make a User/Profile/Logon/DataStorage online database setup? I'm not asking for a gimmigimmi-makeitsimple, just a pointer in the right direction and perhaps clear up some of the misunderstandings and confusion I have about online databases.

Thank you every and all for any input you may give!

like image 688
Parad0x13 Avatar asked Feb 21 '11 07:02

Parad0x13


People also ask

What database is used for iOS apps?

SQLite is popular among developers for a variety of reasons. Some consider the SQLite database the most convenient database for their iOS app because of its straightforward implementation. The software is lightweight and easy to integrate into devices like mobile phones and digital cameras.

Can I use MySQL with iOS app?

The first step in learning how to connect an iOS app to a MySQL database is configuring the backend. We will need a MySQL server of course, but we will also need a simple API. Our app won't connect directly to the database, instead, it will need to send requests to an API that we will write.

Does my app need a database?

Do you always need a database for your app? Of course not. As with everything in technology, nothing is ideal in every situation. Computers offer many various ways to store data.


1 Answers

My current iPhone app does exactly what you are describing. It consists of library on the iPhone called Objective Resource http://iphoneonrails.com/ which coverts the NSObject representation of for example a User object into JSON and communicates via HTTP over the 'net to a Ruby On Rails server http://rubyonrails.org/ which then runs queries against MySQL database which is basically like a free version of SQL Server. It's what you would call a three tier system http://en.wikipedia.org/wiki/Multitier_architecture: the iPhone client, the Ruby On Rails data access layer and MySQL database which is the database layer. This is pretty standard.

So what happens when the user types in his name and password in my system is that the iPhone app changes the name and password on User object. The Objective Resource library then translates the data contained in the User object into JSON and then posts it to my Ruby On Rails site. A method on one of controllers on the Ruby On Rails stack grabs the data then runs an Update on the Users table on the MySQL database.

You can run a variety of different data access layers such as PHP and ASP.NET and databases such as Postgres, SQL Server and Oracle. But Ruby On Rails is free and so is MySQL wheras some of the others aren't.

like image 55
Robert Redmond Avatar answered Sep 20 '22 00:09

Robert Redmond