tyler53
tyler53

Reputation: 429

iOS and Mac OSX communicating with MySQL database

I have a client who wants a control panel for the app I am developing them. The control panel is a Mac OSX application that allows the user to submit files (excel docs and such) to my MySQL database. Those files are then checked by the iOS app I have created for them.

I have no idea how to do this. I have the MySQL database all set up, and I have looked everywhere for a solution. Any help is appreciated.

Upvotes: 0

Views: 369

Answers (3)

Andreas Wederbrand
Andreas Wederbrand

Reputation: 39991

I wouldn't try to connect to your MySQL database directly from your cell phone. It's a bad design for several reasons. Instead build a API on the same server as the MySQL database. It doesn't matter if you do it in java, php, c# or anything else. You might even find some product or open source project that can do this automatically. I've listed some benefits of doing it this way

  1. It makes testing easier. You can write a test framework against your API that doesn't rely on or is using a phone.
  2. It makes development faster. You don't need to emulate or use a phone to develop and test your table design and queries.
  3. It gives you compatibility. When you need to change your database (and you do) you can create new APIs that the new version of the app uses while and old version still out there can continue to use the old API (that you might have to modify to still provide the same functionallity)
  4. It gives you flexibility. If your user base grows and you might need to have replication for reads or sharded databases you build that into the API instead of into the app which is just a better way to do it.

Upvotes: 2

Staros
Staros

Reputation: 3282

I have never found a suitable Object-C based connector for MySQL. At this point I would suggest using a C/C++ connector. There's lots of examples of how to configure the connector for both C and C++. The hard part will be all of the data passed from the MySQL code and the Object-C code will that it will have to be in C types.

EDIT: An Example

Upvotes: 0

Kiran Panesar
Kiran Panesar

Reputation: 3204

One option would be to use PHP to handle all the database interaction.

Host the scripts on the server and just have the apps call them and get the scripts to return some sort of parseable response (I'd go for JSON).

Upvotes: 1

Related Questions