Disclaimer : I’m not a Linux Expert, and I’m sure that doing everything as root is bad, just like doing everything as a Domain Admin account is bad.
Having seen that the CTP version of the Microsoft SQL Server ODBC Driver for Linux has been released, I thought that it would be an interesting thing to play with. Particularly since it might be something I’ll interact with using C++.
Officially, it’s supported on Red Hat Enterprise Linux, but I’ve not got that, and you have to pay for it (not much, but still). Having downloaded Fedora 16,installed it in a VM (VMWare Workstation), and fired it up, I needed to install a number of prerequisites.
Using the Add/Remove Software option in Applications –>System Tools, I installed these Packages:
- Development Libraries
- Development Tools
I also needed to install wget. Type it into Filter box, tick the box against the result and click Apply.
Then download the driver from here: http://www.microsoft.com/download/en/details.aspx?id=28160
To get everything to work, I downloaded the files into the Downloads directory, and follow the instructions on the MS Downloads page (copied below, and with an item (3) added by me to make life easier).
|To install the driver manager:
Next up, we need to install the driver, again, follow the instructions from the MS Download page (copied here):
|To install the driver:
Resolving library issues
That then completed the installation. However, I did get a couple of issues when running sqlcmd. These issues were down to different versions of a couple of Linux SSL libraries being installed, rather than the expected version. Having had a root (pun not intended) around, the issues were resolved by adding a couple of symbolic links (kind of like shortcuts, kind of…), by doing this:
|ln –s /lib64/libcrypto.so.1.0.0.e /lib64/libcrypto.so.6
ln –s /usr/lib64/libssl.so.10 /usr/lib64/libssl.so.6
Time to Play!
As if by magic, I can now query a SQL Server database, from Linux!
This was surprisingly straightforward I thought. My next thoughts will be to see if I can communicate with it from code (C++ since it’s Linux ).
Update – 26/1/2012
It’s been requested that I post the odbc.ini and odbcinst.ini files I used. These are shown below, and are unchanged by me.
[SQL Server Native Client 11.0]
Description=Microsoft SQL Server ODBC Driver V1.0 for Linux