0

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.

user2741735
  • 41
  • 1
  • 6

3 Answers3

1

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

Community
  • 1
  • 1
Bubba
  • 11
  • 1
0

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/

Jay Gajjar
  • 2,661
  • 2
  • 21
  • 35
  • I know webservices is the obvious option but how to implement those services. An brief explanation on this please.... – user2741735 Oct 05 '13 at 12:00
  • for webservices you should have your own domain. On that domain you can put your own webservices made in php, .net or any other language. Regarding how to use it on ios that i already showed u. – Jay Gajjar Oct 07 '13 at 04:03
0

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.

jnortey
  • 1,625
  • 2
  • 10
  • 17