I currently have an ASP page which I connect to from my Objective-C code, but I would like to know if any other method is possibly. I would like to just connect from the iPhone to the Access database without the ASP page. I have tried Googling this problem, but I did not find anything useful. Links to tutorials or code snippets would both be very helpful.
How would you connect to a Microsoft Access database sitting on a remote server through Objective-C?
2 Answers
You should write a webService which will connect to the database, and your iPhone app should be making calls to the webService ideally.

- 2,344
- 3
- 18
- 27
-
What do you mean by a webService? – futurevilla216 Feb 24 '11 at 12:36
-
A server side code, which will connect to your remote database and return you the result in some language independent format like xml or json. – Vaibhav Tekam Feb 24 '11 at 12:46
-
That is what I do right now, my question was if it was possible to do that without the webService. If there was some class in Cocoa that would connect to the database without the webService. – futurevilla216 Feb 24 '11 at 14:10
-
I don't think so. Alternatively you can use at best JSON to get the database as plain object encoded in text/string. – karim Feb 24 '11 at 16:07
I can't answer inline but my answer relates to Vaibhav Tekam's answer...
You should be able to find some sample code that will wrap an access database with a web service. Just search for "web service access database" and you should find some examples. The best practice is to expose only the data that you need through a simple set of methods. If you have students in your access database, you'll want a method for getStudentList
and one for getStudentById(string studentId);
Nonetheless, you cannot connect to an access database directly from an external device (its possible but not recommended). You should use JSON to send and receive the data between your app and the web service.
There is no class in Cocoa to communicate with an access database. If you are anticipating more than about 10 people using your app, then you should move to a database platform that supports higher concurrency.

- 902
- 7
- 13
-
Okay. What I currently do is have a separate ASP page for everything I need to do with the database. For example, I have one page to register a user, another one to login, etc. Is this different from what you are suggesting? – futurevilla216 Feb 24 '11 at 19:02
-
are those pages, the pages of website?? If yes, then that's not what everyone here is trying to tell you. Else If you have a web-service, then you just simply need to make a call to the service, get the data, parse it if needed and use it accordingly. Here is one link -http://www.icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/ – Vaibhav Tekam Feb 25 '11 at 07:57
-
@Vaibhav Yes, I have a separate page on the website for every task I need to accomplish. I am still not seeing what the difference is between what the site is describing and what I am doing... – futurevilla216 Feb 25 '11 at 14:47