user2945601
user2945601

Reputation: 79

how to connect to database from iOS app?

i am beginner in databases and Xcode programming.

i am now installed mysql database, phpmyadmin and Seguel pro for testing.

i created new database and table with phpmyadmin. with segue pro i am connected to database and everything works.

now, i want to connect to this database to read all data to nsarray to show them in tableview. my host is 127.0.0.1, username is "ssebastijan", password is "password", database name is "sebastijan", table name is "test" and port is 3306.

can somebody post code for connection, or explain me how to connect. i already trying two days goggling, but i can't find answer.

thank you!

Greetings from Croatia. Sebastijan Sakač

Upvotes: 1

Views: 339

Answers (1)

Hermann Klecker
Hermann Klecker

Reputation: 14068

I don't think it is a good idea accessing the database directly. Using a web service (REST) on the server and accessing the web service from the iOS client is not only common but highly recommended. You can, however, access mysql diretly as you would do in any plain C program. Here is an expample. http://blog.iosplace.com/?p=30

Upvotes: 1

Related Questions