# SQL Server Driver

**URL:** <https://forums.swift.org/t/sql-server-driver/20327>\
**Category:** Pitches\
**Tags:** sql-server, sswg\
**Created:** [February 10, 2019, 8:39pm UTC](https://forums.swift.org/t/sql-server-driver/20327 "2019-02-10T20:39:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mordil](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mordil/32/5840_2.png) [@Mordil](https://forums.swift.org/u/Mordil)\
**Post date:** [February 10, 2019, 8:39pm UTC](https://forums.swift.org/t/sql-server-driver/20327/1 "2019-02-10T20:39:11Z")

</div>

As part of the [Server work group, new focus](https://forums.swift.org/t/server-work-group-new-focus-areas/15969) thread, the following was mentioned:

> [@Server work group, new focus areas](https://forums.swift.org/t/server-work-group-new-focus-areas/15969/1):
>
> ## Database Drivers and Storage Clients
> 
> As many as possible, some critical items include:
> 
> - postgres
> - mysql
> - redis
> - foundationdb
> - cassandra
> - mongodb
> - zookeeper
> - kafka

However, I know that since at least May of 2018 - someone has been [asking for Vapor to support Microsoft's SQL Server](https://github.com/vapor/fluent/issues/473).

I was wondering how many people feel this is a priority over any of the ones listed above - given that there's been some questioning of how to increase the adoption of Swift, with discussion moving towards [Windows support](https://forums.swift.org/t/swift-as-a-cross-platform-language-and-windows-support/12547) as a vector for that.

As SQL Server is used largely in enterprise environments, that might affect opinions on the priority of this library.

---

<div class="post-metadata">

**Author:** ![sveinhal](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sveinhal/32/3992_2.png) [@sveinhal](https://forums.swift.org/u/sveinhal)\
**Post date:** [February 10, 2019, 9:01pm UTC](https://forums.swift.org/t/sql-server-driver/20327/2 "2019-02-10T21:01:43Z")

</div>

For me, postgres is the most important of the ones listed.

---

<div class="post-metadata">

**Author:** ![Mordil](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mordil/32/5840_2.png) [@Mordil](https://forums.swift.org/u/Mordil)\
**Post date:** [February 10, 2019, 9:04pm UTC](https://forums.swift.org/t/sql-server-driver/20327/3 "2019-02-10T21:04:12Z")

</div>

I worded my intention incorrectly: What are people's thoughts on the priority of this library?  
Just as high (meaning it joins the list) or lower.

Postgres has already been identified as coming up first among the database drivers.

---

<div class="post-metadata">

**Author:** ![3a4oT](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/3a4ot/32/721_2.png) [@3a4oT](https://forums.swift.org/u/3a4oT)\
**Post date:** [February 11, 2019, 9:12am UTC](https://forums.swift.org/t/sql-server-driver/20327/4 "2019-02-11T09:12:46Z")

</div>

@Mordil, very excited to see this thread. As you pointed - "SQL Server is used largely in enterprise environments" and currently there is no way to start experiments with Vapor/ Kitura to proof value/benefits for a business/engineers. IMHO support of Microsoft's SQL Server is very important for server-side Swift. I don't know much about driver development but would love to learn or help with by following the process of development.

---

<div class="post-metadata">

**Author:** ![fatto](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/fatto/32/6159_2.png) [@fatto](https://forums.swift.org/u/fatto)\
**Post date:** [February 12, 2019, 10:28pm UTC](https://forums.swift.org/t/sql-server-driver/20327/5 "2019-02-12T22:28:30Z")

</div>

Im probably gonna create a simple net core CRUD service to interact with a Microsoft SQL server for an application I’m developing right now with Vapor, a native support for it would definitely be better. In my experience is common to interact with mssql either for legacy data or project management software interaction. I don’t mind to use Postgres or MySQL or whatever when I can choose, but more often than not I need to also interact with mssql so that would definitely have an higher priority for me.

---

<div class="post-metadata">

**Author:** ![richgabrielli](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/richgabrielli/32/6169_2.png) [@richgabrielli](https://forums.swift.org/u/richgabrielli)\
**Post date:** [February 13, 2019, 1:46pm UTC](https://forums.swift.org/t/sql-server-driver/20327/6 "2019-02-13T13:46:27Z")

</div>

I am all for SQL Server. Since it is so widely used in the enterprise, Vapor support would open up a tremendous amount of opportunity.

---

<div class="post-metadata">

**Author:** ![spender](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/spender/32/6285_2.png) [@spender](https://forums.swift.org/u/spender)\
**Post date:** [February 22, 2019, 11:30pm UTC](https://forums.swift.org/t/sql-server-driver/20327/7 "2019-02-22T23:30:51Z")

</div>

Microsoft SQL Server would be amazing. So many enterprise apps. would just be uplifted by this.

Please make this happen.

I have been researching ODBC connectivity from Swift and this might be a great option for Linux and OSX support.

---

<div class="post-metadata">

**Author:** ![Mordil](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mordil/32/5840_2.png) [@Mordil](https://forums.swift.org/u/Mordil)\
**Post date:** [February 23, 2019, 1:35am UTC](https://forums.swift.org/t/sql-server-driver/20327/8 "2019-02-23T01:35:08Z")

</div>

I'm glad to hear the enthusiasm for seeing this done - I'll get started on an implementation and proposal as soon as I can.

---

<div class="post-metadata">

**Author:** ![spender](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/spender/32/6285_2.png) [@spender](https://forums.swift.org/u/spender)\
**Post date:** [March 27, 2019, 8:46pm UTC](https://forums.swift.org/t/sql-server-driver/20327/9 "2019-03-27T20:46:33Z")

</div>

I've started. Please have a look at my efforts at [http://www.binaryrefinery.com](http://www.binaryrefinery.com)

Please feel free to help me tidy up my own code :-)

---

<div class="post-metadata">

**Author:** ![spender](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/spender/32/6285_2.png) [@spender](https://forums.swift.org/u/spender)\
**Post date:** [March 27, 2019, 8:55pm UTC](https://forums.swift.org/t/sql-server-driver/20327/10 "2019-03-27T20:55:58Z")

</div>

I would also like to add. My pitch rightly/wrongly was for ODBC support from Swift. This would maybe more generic than a straight SQL Server implementation.

---

<div class="post-metadata">

**Author:** ![Mordil](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mordil/32/5840_2.png) [@Mordil](https://forums.swift.org/u/Mordil)\
**Post date:** [March 27, 2019, 10:28pm UTC](https://forums.swift.org/t/sql-server-driver/20327/11 "2019-03-27T22:28:27Z")

</div>

That's fine - from what I've seen in my preliminary research is that there is a shared wire protocol with SQL Server and at least Oracle: [Tabular Data Stream](https://en.wikipedia.org/wiki/Tabular_Data_Stream).

I think it'd be a great goal to have a module that handles the wire protocol itself - and then another that consumes the TDS to provide specific SQL Server capabilities.

---

<div class="post-metadata">

**Author:** ![spender](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/spender/32/6285_2.png) [@spender](https://forums.swift.org/u/spender)\
**Post date:** [March 27, 2019, 10:45pm UTC](https://forums.swift.org/t/sql-server-driver/20327/12 "2019-03-27T22:45:18Z")

</div>

I was looking at UNIXODBC as my start point.

Richard Jones

---

<div class="post-metadata">

**Author:** ![spender](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/spender/32/6285_2.png) [@spender](https://forums.swift.org/u/spender)\
**Post date:** [March 28, 2019, 9:28am UTC](https://forums.swift.org/t/sql-server-driver/20327/13 "2019-03-28T09:28:31Z")

</div>

Actually I think you might be onto something.

The Tabular Data Stream, is the lowest level implementation practically possible. The wire protocol would have the benefit of no external dependencies, which I guess would be very much in the Swifty spirit.

I like

---

<div class="post-metadata">

**Author:** ![spender](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/spender/32/6285_2.png) [@spender](https://forums.swift.org/u/spender)\
**Post date:** [April 3, 2019, 7:46pm UTC](https://forums.swift.org/t/sql-server-driver/20327/14 "2019-04-03T19:46:41Z")

</div>

I've made some good progress. Please have a look at my blog at [http://binaryrefinery.com](http://binaryrefinery.com)

---

<div class="post-metadata">

**Author:** ![natebird](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/natebird/32/596_2.png) [@natebird](https://forums.swift.org/u/natebird)\
**Post date:** [April 23, 2019, 12:35pm UTC](https://forums.swift.org/t/sql-server-driver/20327/15 "2019-04-23T12:35:14Z")

</div>

Using the Tabular Data Stream and creating packages with support for SQL Server and Oracle wire protocols would be a big step toward supporting large enterprise customers.

---

<div class="post-metadata">

**Author:** ![spender](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/spender/32/6285_2.png) [@spender](https://forums.swift.org/u/spender)\
**Post date:** [April 23, 2019, 4:17pm UTC](https://forums.swift.org/t/sql-server-driver/20327/16 "2019-04-23T16:17:32Z")

</div>

I totally agree.

---

<div class="post-metadata">

**Author:** ![spender](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/spender/32/6285_2.png) [@spender](https://forums.swift.org/u/spender)\
**Post date:** [April 23, 2019, 8:32pm UTC](https://forums.swift.org/t/sql-server-driver/20327/17 "2019-04-23T20:32:41Z")

</div>

Where to start ....?

> **[\[MS-TDS\]: Tabular Data Stream Protocol](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/b46a581a-39de-4745-b076-ec4dbb7d13ec)**
>
> Specifies the Tabular Data Stream Protocol, which is an application layer request/response protocol that facilitates interaction with a database

---

<div class="post-metadata">

**Author:** ![ajedwards](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ajedwards/32/36084_2.png) [@ajedwards](https://forums.swift.org/u/ajedwards)\
**Post date:** [November 14, 2019, 5:33pm UTC](https://forums.swift.org/t/sql-server-driver/20327/18 "2019-11-14T17:33:35Z")

</div>

While my experience is limited, I studied the TDS protocol about a year back in hopes of creating an implementation in Swift. I didn't end up going anywhere with this, but I am still very interested. The protocol is heavily documented and I second this approach.

Above you mentioned you would be starting an implementation. Is this something that you have already started on?

---

<div class="post-metadata">

**Author:** ![Mordil](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mordil/32/5840_2.png) [@Mordil](https://forums.swift.org/u/Mordil)\
**Post date:** [November 14, 2019, 7:39pm UTC](https://forums.swift.org/t/sql-server-driver/20327/19 "2019-11-14T19:39:18Z")

</div>

No, I have not started any implementation towards an SQL Driver.

The Redis driver has been my primary focus, and the Fall season has severely cramped my ability to invest in anything other than Redis.

The only progress towards this effort that I've been aware of is that from @spender

---

<div class="post-metadata">

**Author:** ![ajedwards](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ajedwards/32/36084_2.png) [@ajedwards](https://forums.swift.org/u/ajedwards)\
**Post date:** [December 2, 2019, 11:06pm UTC](https://forums.swift.org/t/sql-server-driver/20327/20 "2019-12-02T23:06:57Z")

</div>

@spender I would be curious to see what sort of progress you've made up to this point, if any. I've begun an implementation myself and am hoping to get a proof of concept w/ simple connection and query capabilities up and running within a week or so.

[Next page](https://forums.swift.org/t/sql-server-driver/20327.md?page=2)
