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

I am building a MAC application using the cocoa infrastructure, I would like to know how and in what ways I can connect to the MySql database using the cocoa infrastructure.

+4
source share
2 answers

You might want to check out http://www.sequelpro.com/docs/Source_Code . They seem to have revived the MySQL-Cocoa source code and seem to be in active development. Another option is the commercial MacSQL platform.

Edit: You can also see the following tutorial . This is a great introduction to using libmysqlclient and even provides a sample Xcode project.

+5
source

Short answer: you cannot, at least not directly.

Cocoa Framework does not have a database driver, generic or otherwise (regardless of CoreData). To connect to the mysql database, you need to use aptly named libmysqlclient . This library is not included in Xcode, and therefore it will need to be downloaded (and possibly built) separately: you can get it here .

You may have to redistribute the library with your application, and you may experience license problems.

Edit: It seems that the library for connecting to the mysql database should be installed along with the installation of the MySQL server. If the application will need to be run only on machines on which MySQL is installed, you may be referred to this.

0
source

Source: https://habr.com/ru/post/1310209/


All Articles