Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode connect to the MS SQL database

I have an existing database up and running on the remote MS SQL server, and I want to be able to communicate and interact with that database from Xcode. I am writing an application for OS X in Swift, and the data that the application should use, is stored in that remote database.

The problem is, I can't seem to find any Swift library that could connect to the MS SQL server based database. So far, I have only found this open-source library: SQLClient in Objective-C, but it's quite difficult to have it set, especially as I am not familiar with the Objective-C.

Also, I keep seeing this Core-Data library being mentioned anytime there is some communication with the database, but as far as I understand Core-Data doesn't know how to connect to the MS SQL database.

Does anyone have any experience in connecting the Xcode Swift app to the remote MS SQL database? How should one do this? Any kind of advice is more than welcome, because right now I am kind of stuck with this problem.

like image 615
zwiebl Avatar asked Aug 02 '16 09:08

zwiebl


People also ask

How do I connect to a SQL Server database?

Connect to a SQL Server instanceStart SQL Server Management Studio. The first time you run SSMS, the Connect to Server window opens. If it doesn't open, you can open it manually by selecting Object Explorer > Connect > Database Engine. For Server type, select Database Engine (usually the default option).

Can you use SQL in Xcode?

All replies. You can use the C-Interface routines to pass SQL commands to a Database with X-Code - all of the Database programs have C and Java libraries for that purpose.

Can you use SQL with Swift?

SQLite is a C API that will have you work with both SQL, and... C from Swift. There exist Swift libraries that wrap the C functions in Swift, so that you don't have to learn C from Swift: GRDB - this is my favourite since I created it - but many other people love it as well.


1 Answers

The ideal way is to write webservices in any serverside language such as php, asp etc. The webservices will communicae with your mysql database and you swift code will communicate to the webservices.

like image 86
Abdul Wahab Avatar answered Oct 20 '22 21:10

Abdul Wahab