P
P
Paka2012-07-03 16:30:52
MySQL
Paka, 2012-07-03 16:30:52

Connecting to MySQL from an iPhone app?

I am an iphone application customer. And I don't want to use xml to exchange data between my mysql server and application.
Is it possible to add some driver (or something) to the iphone application to connect to the server and execute sql queries, get responses?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
R
reminded, 2012-07-03
@reminded

You can use this API - mysql-cocoa.sourceforge.net/
But somehow it is unreliable to directly open a connection from a mobile device to the database ...
Usually, they still make an intermediate layer. Well, i.e. they write a server (on anything, at least in PHP) that pulls the mobile device and it already climbs into the database and then gives the answer to the iphone in the desired format.

K
Konstantin, 2012-07-03
@Norraxx

Giving a full database connection is bad practice.
I suggest you think about it and do everything through your API for the program and the database (for example, Python / PHP + JSON).
I know it sounds like a lot of work, but it will keep you out of trouble.
And if you have already given someone access to the database, cut off all (unnecessary) rights, do most of the things through the view, limit the connected user as much as possible ...
PS: MySQL protocol also transfers a lot of data over the network, don’t think about it.

S
SAKRIST, 2012-07-03
@SAKRIST

yes, really
sorry, but I don’t remember where I took libmysqlclient.a + headers

K
karenishe, 2012-07-03
@karenishe

I would do it through an API that can be implemented in any language from the server side where the base is located.

P
Paka, 2012-07-03
@Paka

Thanks for the advice.
And how will the two options fundamentally differ:
1) Directly connect to mysql
2) Put a php script on the server that will execute any incoming sql query and give an xml file for SELECT.
I don’t understand why these gaskets are needed in principle, when I have my application. If I give third-party developers the opportunity to use my server, then yes: I give only what I want and how I want. But when ios clients are also completely mine, there is no need for extra spacers.
PS In one project, I organized a 1C connection to mysql directly through the driver, instead of exchanging files. This approach proved to be very stable and good, and errors with misunderstandings immediately disappeared.
I want to apply this successful experience in a mobile application.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question