Connect to MySQL directly from an iPad app (not via PHP, etc.)

11,451

Solution 1

This might be the sort of thing that you are looking for:

mysql for iphone and osx

I found it on this iphonedevsdk thread access mysql remote database iphone

Personally I would be only doing this if you really really wanted to.

If you wanted a canned solution, I also found this: Flipper

Or to do it yourself: Build MySql client library for iPhone/iPad

Its not really that hard to find a number of solutions

Solution 2

I needed the same thing (I understand your lecture-pain ;) ) so I wrote this: https://github.com/ciaranj/MySqueakQl it doesn't link to the mysql client libraries so no GPL issues, but it is a very minimal ... very 'fresh' i.e. untested implementation ... just my 2c.

Share:
11,451
Chad
Author by

Chad

Updated on June 04, 2022

Comments

  • Chad
    Chad almost 2 years

    Before anyone has a chance: Yes, i know it's a bad idea. Please, don't give me a lecture on how i should use a web service instead. Thanks.

    So, how could this be done?

    I found this bit http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/ and thought it might do the trick. I got a bunch of ARC error messages, cleaned those out and got this error at runtime:

    Detected an attempt to call a symbol in system libraries that is not present on the iPhone: pthread_cond_init$UNIX2003 called from function my_thread_init in image oms.

    Do i need to use something like ODBC/C?

    I know that the solution might be a lengthy one, that's fine. Would be great if someone could at least point me in the right direction.

    EDIT:

    Since people are keen to know the reason for opting not to use a web service, here it is:

    If you're creating an in-house app, the added security of a web service is next to nothing. Working directly with the DB means i need to maintain less code. Plus i don't need to create hacky PHP scripts to get things done.

    FINAL CONCLUSION:

    I wanted to leave a message for people who're about to do the same thing: Don't :) Essentially your options are hacky server side scripts or Oracle proprietary mysql client you built yourself (and thus a hacky solution as well). Your choice but i'd strongly advice against it.