user2741735
user2741735

Reputation: 41

Connecting to SQL database inside iPhone App

I wanted to know the procedure to connect to SQL Database from an iPhone app. The read and write procedure to the SQL database and syncing it with iPhone's local database which is in sqlite, so that any changes in SQL database/sqlite database should be reflected on both.

Upvotes: 0

Views: 2763

Answers (3)

Bubba
Bubba

Reputation: 11

The above answers are lacking. If you want to connect directly to a SQL sever from an iOS device you can use freeTDS. There are several compiled version that run on iOS. It is not as difficult as drag and drop developers would lead you to believe.

Cross compiling FreeTDS to iPhone

Upvotes: 1

jnortey
jnortey

Reputation: 1625

High level summary:

  1. Construct your local storage database (available sqlite libraries: TankDB (made by me), FMDB)
  2. Create your remote database with frontend webservices for interacting with the database (REST services using PHP might be a good idea for beginners: PHP to MySQL)
  3. Create a way for your iPhone application to communicate with the hosted frontend webservices (available library: ASIHTTP)

You would use the ASIHTTP library from the iPhone to make a REST call to your hosted php files. The "sync" logic would be in your hosted php files and on the iPhone callbacks that are receiving the data.

Keep in mind this is a very simplified overview, but I think its enough to get the ball rolling.

Upvotes: 0

Jay Gajjar
Jay Gajjar

Reputation: 2741

Firstly ios dosent support sql database.

If you have sql database on webserver, then you have to create webservices to perform CRUD operations.

Here is simple tutorial for webservices in ios http://www.techrepublic.com/blog/ios-app-builder/ios-tutorial-part-1-creating-a-web-service/

Upvotes: 0

Related Questions