How can I make connection between swift and mysql ?

Hi Guys.


I am creating a simple ios app for user registration using swift 3.1 and xcode 8.3.3 on macOS.


I want to save all the information related to user registration in MySQL database,but for this I need to connect with MySQL server.


I did research over this but I didn't found any references or link which is helpfull for me.actually most of the refrences using PHP to connect with MySQL but I dont want use this .


So could you please suggest me the way that how can I connect with MySQL?


Thanks ,

Arun Kaushik

I assume your MySQL is running somewhere in the server (maybe in your mac while development stage). Meaning which is not placed in each iOS device.


Connecting mobile devices to a database server directly is considered to be an obsolete way and too risky from the modern point of view in security.


You may need to construct an API server on the server side, and make your iOS app connect to the API server with the standardized technology like HTTP request. (Actually it should be HTTPS.) If you do not prefer PHP, you can choose Ruby or Python or Java or ... any language you want. But I repeat, you should not connect your device directly to a database server. That's one thing you should never do.

Hello

My development area was, until recently, in VB.NET. I have now moved to MacOS and IOS.

I have the same question, how do I connect via IOS to a remote MySQL server?

I am trying to use the swift language.

What languages or processes to use since you say these links are obsolete. Where to store the data?


best regards

Thank you

Even in .net world, connecting clients directly to Database server is considered to be obsolete.


You may need to construct an API server on the server side, and make your iOS app connect to the API server with the standardized technology like HTTP request. (Actually it should be HTTPS.) If you do not prefer PHP, you can choose Ruby or Python or Java or ... any language you want. But I repeat, you should not connect your device directly to a database server. That's one thing you should never do.


If you prefer .net, .net Web API would be a very good tool to create backend serices for mobile devices. You may need to learn how to communicat to RESTful server in Swift, and how to make the RESTful service on the server side.

How can I make connection between swift and mysql ?
 
 
Q