开发者

COCOA Objective-c : How can connect to mysql database?

I am creating application for MAC using cocoa framework, I wo开发者_如何学运维uld like to know how and what are the ways i can connect to MySql database using cocoa framework.


You might want to look into http://www.sequelpro.com/docs/Source_Code. They seem to have resurrected the original MySQL-Cocoa code and it seems to be under active development. The other option is the commercial MacSQL Framework.

Edit: You might also want to look at the following tutorial. It is a great introduction in using the libmysqlclient and even provides a sample Xcode project.


Short answer: You can't, at least not directly.

The Cocoa Framework doesn't have a database driver, generic or otherwise (CoreData notwithstanding). In order to connect to a mysql database you need to use the aptly named libmysqlclient. This library is not included with Xcode, and as such will have to be downloaded (and probably built) separately: You can get it from here.

You'll probably have to distribute the library with your application, license issues might result.

Edit: It seems as if a library for connecting to the mysql database should be installed together with a MySQL server install. If the application will only need to run on machines where MySQL is installed, you might get away with linking to this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜