Search code examples
objective-csql-serverswift3ibm-cloudkitura

Using Microsoft SQL Server in Kitura


I need to check if I could use SQL Server with Kitura hosted in Bluemix using ICT (IBM Cloud Tool). I like the idea of Swift in the Server but at the same time I only know Microsoft SQL Server Database which is hosted externally and would like to call that in my Kitura Server and then expose as WebService/API.

I found a good ObjectiveC library which can make SQL Server Connection. but that is ObjectiveC, and could work with Swift. https://github.com/martinrybak/SQLClient but when I installed it in the Kitura Project it throws errors (I can provide details...)

Just wondering if any one knows :

1) Is there a way to use SQL Server which I can call in Kitura Server. (Outside BlueMix)

2) Is there a way to install Cocoapods in Kitura - specially if Cocoapods installs an ObjectiveC library. Can I use a bridging header to bring that in the Kitura Server code. (I tried but don't seem to work)

3) Is there a way to use Microsoft SQL Server which I can call in Kitura Server. (Within BlueMix)

Many Thanks.


Solution

  • As you mentioned the project you found for connecting to Microsoft SQL Server is written in Objective C.

    Kitura based applications, when running on Bluemix, are built using Swift Package Manager (SPM). Even for macOS, where there is an Objective C runtime for Swift, I don't think SPM knows how to create the proper bridging header. In addition there is no Objective C runtime for Swift on Linux.

    However, there is Swift-Kuery (https://github.com/IBM-Swift/Swift-Kuery), our Relational Database abstraction layer. We currently have a plugin for PostgreSQL, with one for SQLite well under way. In addition we are starting to work on one for MySQL as well.

    There exist ODBC drivers that can be worked with from Swift. Using one of those it might not be too hard to build a Microsoft SQL Server plugin for Swift-Kuery.

    At this time we don't have any plans for an SQL Server plugin for Swift-Kuery, but we'd love to see one from the community.