Objective-C Database Connections
I am looking for a way to connect to a database(Mysql, PostgreSQL, MSSQL) in Objective for the IPhone. It seems though that support for connecting to the databases isn't really supported by the language and third party solutions are all over the place.
Is there a solution that would be recommended best for each or a solution 开发者_Go百科that can be used for all of the them?
To be honest, the route I've always gone down has been setting up an intermediary site to control the Data Layer Mapping, and control the back and forth between the iPhone and the database.
This sets you setup a middle man (say it's a PHP web page), that then lets you connect to whichever type of DB you want, and you can just make service calls to the web to trigger what you need.
That's just the way I go though...I know there are plenty Objective C compiled MySQL connectivity packages and things like that, but I like working in something a bit more supported and familiar, and let the iPhone just worry about handling the data once it has it.
If you are looking for database support directly on the iPhone you will want to use SQLite which is accessible directly through the library or Core Data
. If you need to connect to an existing database like mysql or Sql Server you will need to expose some methods through webservices (SOAP, RESTful) to interact with the database (CRUD). If you are wondering why there is limited/no support for directly accessing other types of databases check out the Distinctive Features of SQLite.
What about MySQL Connector/C?
Refer to this SO post: here
精彩评论