Hi.
This is my first post at MacScripter. I am following this forum a long time an i hope that my hint is interesting for you.
I was very surprised to see an article in an german mac coding magazin (Mac Developer 4/2010) about connecting from ObjC to an MySQL Database within a few lines of code. In this example some portions of C Code was used within ObjC. And from there ASOC can use it too!
All you need:
-is an MySQL installation from http://dev.mysql.com/downloads/connector/odbc/.
-a simple additional ObjC Class in your ASOC code.
-a few modifications in the build settings of the project
The additional build settings are as follows:
Other Linker Flags: -lz -lm -lmysqlclient
Header Search Paths: /usr/local/mysql/include/**
Library Search Paths: /usr/local/mysql/lib/**
You can find a zipped ASOC example here:
www.qusa.de/fileadmin/asoc/src/MySQL_Quicktest.zip
The resultset of the mysql query would be returned as an NSMutableArray.
The original ObjC Code:
http://www.mac-developer.de/content/download/3013/78453/file/2010-04%20MySQL.zip
My ObjC knowledge is very poor. Maybe you have hints to optimize the code.
Best Regards from germany
samowitsch
Model: MBP13
Browser: Safari 533.18.5
Operating System: Mac OS X (10.6)