ODBC Driver 13.0 for Linux Released


Hi all, we are delighted to share the Production Ready release of the Microsoft ODBC Driver 13 for Linux –  (Ubuntu, RedHat and SUSE). The new driver enables access to SQL Server, Azure SQL Database and Azure SQL DW from any C/C++ application on Linux

What’s new

  • Native Linux Install Experience: The driver can now be installed with apt-get (Ubuntu), yum (RedHat/CentOS) and Zypper (SUSE). Instructions on how to do this is below.
  • AlwaysOn Availability Groups (AG): The driver now supports transparent connections to AlwaysOn Availability Groups. The driver quickly discovers the current AlwaysOn topology of your server infrastructure and connects to the current active server transparently.
  • TLS 1.2 support: The driver now supports TLS 1.2 connections to SQL Server.

Install the ODBC Driver for Linux on Ubuntu 15.10

sudo su 
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/15.10/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql=13.0.1.0-1 mssql-tools=14.0.2.0-1
sudo apt-get install unixodbc-dev-utf16 #this step is optional but recommended*
#Create symlinks for tools
ln -sfn /opt/mssql-tools/bin/sqlcmd-13.0.1.0 /usr/bin/sqlcmd 
ln -sfn /opt/mssql-tools/bin/bcp-13.0.1.0 /usr/bin/bcp

Install the ODBC Driver for Linux on Ubuntu 16.04

sudo su 
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql=13.0.1.0-1 mssql-tools=14.0.2.0-1
sudo apt-get install unixodbc-dev-utf16 #this step is optional but recommended*
#Create symlinks for tools
ln -sfn /opt/mssql-tools/bin/sqlcmd-13.0.1.0 /usr/bin/sqlcmd 
ln -sfn /opt/mssql-tools/bin/bcp-13.0.1.0 /usr/bin/bcp

Install the ODBC Driver for Linux on RedHat 6

sudo su
curl https://packages.microsoft.com/config/rhel/6/prod.repo > /etc/yum.repos.d/mssql-release.repo
exit
sudo yum update
sudo yum remove unixODBC #to avoid conflicts
sudo ACCEPT_EULA=Y yum install msodbcsql-13.0.1.0-1 mssql-tools-14.0.2.0-1
sudo yum install unixODBC-utf16-devel #this step is optional but recommended*
#Create symlinks for tools
ln -sfn /opt/mssql-tools/bin/sqlcmd-13.0.1.0 /usr/bin/sqlcmd 
ln -sfn /opt/mssql-tools/bin/bcp-13.0.1.0 /usr/bin/bcp

Install the ODBC Driver for Linux on RedHat 7

sudo su
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo
exit
sudo yum update
sudo yum remove unixODBC #to avoid conflicts
sudo ACCEPT_EULA=Y yum install msodbcsql-13.0.1.0-1 mssql-tools-14.0.2.0-1
sudo yum install unixODBC-utf16-devel #this step is optional but recommended*
#Create symlinks for tools
ln -sfn /opt/mssql-tools/bin/sqlcmd-13.0.1.0 /usr/bin/sqlcmd 
ln -sfn /opt/mssql-tools/bin/bcp-13.0.1.0 /usr/bin/bcp

Install the ODBC Driver for SUSE12

sudo su 
zypper ar https://packages.microsoft.com/config/sles/12/prod.repo 
zypper update 
sudo ACCEPT_EULA=Y zypper install msodbcsql-13.0.1.0-1 mssql-tools-14.0.2.0-1
zypper install unixODBC-utf16-devel
#Create symlinks for tools
ln -sfn /opt/mssql-tools/bin/sqlcmd-13.0.1.0 /usr/bin/sqlcmd 
ln -sfn /opt/mssql-tools/bin/bcp-13.0.1.0 /usr/bin/bcp

Note: Packages for SQL Server command line tools will be available soon. The above mentioned packages only install the ODBC Driver for SQL Server that enable connectivity from any C/C++ application.

Try our Sample

Once you install the driver that runs on a supported Linux distro, you can use this C sample to connect to SQL Server/Azure SQL DB/Azure SQL DW. To download the sample and get started, follow these steps:

wget "https://raw.githubusercontent.com/Microsoft/sql-server-samples/master/samples/tutorials/c/linux/sample_c_linux.c"
gcc sample_c_linux.c -o sample_c_linux -lodbc -w #make sure you change the servername, username and password in the connections string
./sample_c_linux

If you installed the driver using the manual instructions found here, you will have to manually uninstall the ODBC Driver and the unixODBC Driver Manager to use the deb/rpm packages. If you have any questions on how to manually uninstall, feel free to leave a comment below. 

Please fill bugs/questions/issues on our Issues page. We welcome contributions/questions/issues of any kind. Happy programming!

Survey and Future Plans

Please take this survey to help prioritize features and scenarios for the next release of the ODBC Driver for Linux. Going forward we plan to expand SQL Server 16 Feature Support (example: Always Encrypted), improve test coverage, and fix bugs reported on our Issues page.

Please stay tuned for upcoming releases that will have additional feature support and bug fixes. This applies to our wide range of client drivers including PHP 7.0, Node.js, JDBC and ADO.NET which are already available.

Meet Bhagdev (meetb@microsoft.com)

Comments (114)

  1. Gulam Gaus says:

    Is there any way to skip unixODBC installation again if it is already installaed on the server? I have already installed unixODBC and using this for DB2 database connectivity. I don’t wnat to re-install and configure it?

    1. Gulam Gaus says:

      Just to add, i am working with RHEL 7

    2. Meet Bhagdev says:

      Did you install unixODBC from the package manager? If yes, take a look at the 13.1 release. This uses the standard OS provided driver manager: https://blogs.msdn.microsoft.com/sqlnativeclient/2017/02/04/odbc-driver-13-1-for-linux-released/

  2. Alberto Guzman says:

    Is this driver available for ppc64 architecture? (SLES for SAP Applications 11.4 (ppc64) – Kernel 3.0.101-80-default)

    1. Meet Bhagdev says:

      Hi Alberto, we do not support ppc64 architecture. We would love to learn more about your scenarios. Can you create a new feedback item for this here: https://connect.microsoft.com/SQLServer/

  3. Paul Ammirata says:

    I’ve installed the driver and tools on RHEL 7.3 and when I attempt to execute bcp I get the following error:

    Unable to load BCP resource DLL. BCP cannot continue.

    Any help to resolve this would be appreciated. I don’t know if I need to set the LD_LIBRARY_PATH and if I do what I should set it to.

    1. Meet Bhagdev says:

      What steps did you follow to install the tools + driver?

      Can you try installing the ODBC Driver 13.1: https://blogs.msdn.microsoft.com/sqlnativeclient/2017/02/04/odbc-driver-13-1-for-linux-released/. Let us know if you run into the same issue.

      1. Paul Ammirata says:

        I followed the instructions in the link you provided and bcp now works. Thank you for your help.

        Initially I did the following based on this link (https://msdn.microsoft.com/en-us/library/hh568454(v=sql.110).aspx) and that’s when I got the error.
        sudo ACCEPT_EULA=Y yum install msodbcsql mssql-tools
        sudo yum install unixODBC-utf16-devel #this step is optional but recommended*

        I followed the instructions in the link you provided and now bcp works. Here’s a transcript of what I did.

        sudo su
        cd /etc/yjm.repos.d
        wget http://packages.microsoft.com/config/rhel/7/prod.repo
        mv prod.repo /etc/yum.repos.d/mssql-release.repo
        # edited mssql-release.repo to change https to http
        exit

        [root@sldsnpl01 ~]# sudo yum update
        Loaded plugins: langpacks, product-id, rhnplugin, search-disabled-repos, subscription-manager
        This system is receiving updates from RHN Classic or Red Hat Satellite.
        Resolving Dependencies
        –> Running transaction check
        —> Package selinux-policy.noarch 0:3.13.1-102.el7_3.15 will be updated
        —> Package selinux-policy.noarch 0:3.13.1-102.el7_3.16 will be an update
        —> Package selinux-policy-targeted.noarch 0:3.13.1-102.el7_3.15 will be updated
        —> Package selinux-policy-targeted.noarch 0:3.13.1-102.el7_3.16 will be an update
        —> Package tzdata.noarch 0:2017a-1.el7 will be updated
        —> Package tzdata.noarch 0:2017b-1.el7 will be an update
        —> Package tzdata-java.noarch 0:2017a-1.el7 will be updated
        —> Package tzdata-java.noarch 0:2017b-1.el7 will be an update
        —> Package xymon-client.x86_64 0:4.3.18-1.el7 will be updated
        —> Package xymon-client.x86_64 0:4.3.28-1.el7 will be an update
        –> Processing Dependency: liblz4.so.1()(64bit) for package: xymon-client-4.3.28-1.el7.x86_64
        –> Finished Dependency Resolution
        Error: Package: xymon-client-4.3.28-1.el7.x86_64 (xymon_el7)
        Requires: liblz4.so.1()(64bit)
        You could try using –skip-broken to work around the problem
        ** Found 4 pre-existing rpmdb problem(s), ‘yum check’ output follows:
        ipa-client-4.4.0-14.el7_3.6.x86_64 has installed conflicts freeipa-client: ipa-client-4.4.0-14.el7_3.6.x86_64
        ipa-client-common-4.4.0-14.el7_3.6.noarch has installed conflicts freeipa-client-common: ipa-client-common-4.4.0-14.el7_3.6.noarch
        ipa-common-4.4.0-14.el7_3.6.noarch has installed conflicts freeipa-common: ipa-common-4.4.0-14.el7_3.6.noarch
        ipa-python-compat-4.4.0-14.el7_3.6.noarch has installed conflicts freeipa-python-compat: ipa-python-compat-4.4.0-14.el7_3.6.noarch
        [root@sldsnpl01 ~]#

        [root@sldsnpl01 ~]# sudo yum remove msodbcsql mssql-tools unixODBC
        Loaded plugins: langpacks, product-id, rhnplugin, search-disabled-repos, subscription-manager
        This system is receiving updates from RHN Classic or Red Hat Satellite.
        Resolving Dependencies
        –> Running transaction check
        —> Package msodbcsql.x86_64 0:13.1.4.0-1 will be erased
        —> Package mssql-tools.x86_64 0:14.0.4.0-1 will be erased
        —> Package unixODBC.x86_64 0:2.3.1-11.el7 will be erased
        –> Finished Dependency Resolution
        pc_repo | 2.5 kB 00:00:00
        rhel-x86_64-server-7-thirdparty-oracle-java | 1.5 kB 00:00:00

        Dependencies Resolved

        =============================================================================================================================================================
        Package Arch Version Repository Size
        =============================================================================================================================================================
        Removing:
        msodbcsql x86_64 13.1.4.0-1 @packages-microsoft-com-prod 16 M
        mssql-tools x86_64 14.0.4.0-1 @packages-microsoft-com-prod 843 k
        unixODBC x86_64 2.3.1-11.el7 @rhel-x86_64-server-7 1.2 M

        Transaction Summary
        =============================================================================================================================================================
        Remove 3 Packages

        Installed size: 18 M
        Is this ok [y/N]: y
        Downloading packages:
        Running transaction check
        Running transaction test
        Transaction test succeeded
        Running transaction
        Erasing : mssql-tools-14.0.4.0-1.x86_64 1/3
        Erasing : msodbcsql-13.1.4.0-1.x86_64 2/3
        Erasing : unixODBC-2.3.1-11.el7.x86_64 3/3
        warning: /etc/odbcinst.ini saved as /etc/odbcinst.ini.rpmsave
        Verifying : mssql-tools-14.0.4.0-1.x86_64 1/3
        Verifying : unixODBC-2.3.1-11.el7.x86_64 2/3
        Verifying : msodbcsql-13.1.4.0-1.x86_64 3/3

        Removed:
        msodbcsql.x86_64 0:13.1.4.0-1 mssql-tools.x86_64 0:14.0.4.0-1 unixODBC.x86_64 0:2.3.1-11.el7

        Complete!
        [root@sldsnpl01 ~]#

        [root@sldsnpl01 ~]# sudo yum remove unixODBC-utf16 unixODBC-utf16-devel
        Loaded plugins: langpacks, product-id, rhnplugin, search-disabled-repos, subscription-manager
        This system is receiving updates from RHN Classic or Red Hat Satellite.
        No Match for argument: unixODBC-utf16
        No Match for argument: unixODBC-utf16-devel
        No Packages marked for removal
        [root@sldsnpl01 ~]#

        [root@sldsnpl01 ~]# sudo yum update
        Loaded plugins: langpacks, product-id, rhnplugin, search-disabled-repos, subscription-manager
        This system is receiving updates from RHN Classic or Red Hat Satellite.
        Resolving Dependencies
        –> Running transaction check
        —> Package selinux-policy.noarch 0:3.13.1-102.el7_3.15 will be updated
        —> Package selinux-policy.noarch 0:3.13.1-102.el7_3.16 will be an update
        —> Package selinux-policy-targeted.noarch 0:3.13.1-102.el7_3.15 will be updated
        —> Package selinux-policy-targeted.noarch 0:3.13.1-102.el7_3.16 will be an update
        —> Package tzdata.noarch 0:2017a-1.el7 will be updated
        —> Package tzdata.noarch 0:2017b-1.el7 will be an update
        —> Package tzdata-java.noarch 0:2017a-1.el7 will be updated
        —> Package tzdata-java.noarch 0:2017b-1.el7 will be an update
        —> Package xymon-client.x86_64 0:4.3.18-1.el7 will be updated
        —> Package xymon-client.x86_64 0:4.3.28-1.el7 will be an update
        –> Processing Dependency: liblz4.so.1()(64bit) for package: xymon-client-4.3.28-1.el7.x86_64
        –> Finished Dependency Resolution
        Error: Package: xymon-client-4.3.28-1.el7.x86_64 (xymon_el7)
        Requires: liblz4.so.1()(64bit)
        You could try using –skip-broken to work around the problem
        ** Found 4 pre-existing rpmdb problem(s), ‘yum check’ output follows:
        ipa-client-4.4.0-14.el7_3.6.x86_64 has installed conflicts freeipa-client: ipa-client-4.4.0-14.el7_3.6.x86_64
        ipa-client-common-4.4.0-14.el7_3.6.noarch has installed conflicts freeipa-client-common: ipa-client-common-4.4.0-14.el7_3.6.noarch
        ipa-common-4.4.0-14.el7_3.6.noarch has installed conflicts freeipa-common: ipa-common-4.4.0-14.el7_3.6.noarch
        ipa-python-compat-4.4.0-14.el7_3.6.noarch has installed conflicts freeipa-python-compat: ipa-python-compat-4.4.0-14.el7_3.6.noarch
        [root@sldsnpl01 ~]#

        [root@sldsnpl01 ~]# sudo ACCEPT_EULA=Y yum install msodbcsql-13.1.4.0-1 mssql-tools-14.0.3.0-1 unixODBC-devel
        Loaded plugins: langpacks, product-id, rhnplugin, search-disabled-repos, subscription-manager
        This system is receiving updates from RHN Classic or Red Hat Satellite.
        Resolving Dependencies
        –> Running transaction check
        —> Package msodbcsql.x86_64 0:13.1.4.0-1 will be installed
        –> Processing Dependency: unixODBC >= 2.3.1 for package: msodbcsql-13.1.4.0-1.x86_64
        –> Processing Dependency: libodbcinst.so.2()(64bit) for package: msodbcsql-13.1.4.0-1.x86_64
        —> Package mssql-tools.x86_64 0:14.0.3.0-1 will be installed
        —> Package unixODBC-devel.x86_64 0:2.3.1-11.el7 will be installed
        –> Running transaction check
        —> Package unixODBC.x86_64 0:2.3.1-11.el7 will be installed
        –> Finished Dependency Resolution

        Dependencies Resolved

        =============================================================================================================================================================
        Package Arch Version Repository Size
        =============================================================================================================================================================
        Installing:
        msodbcsql x86_64 13.1.4.0-1 packages-microsoft-com-prod 3.9 M
        mssql-tools x86_64 14.0.3.0-1 packages-microsoft-com-prod 248 k
        unixODBC-devel x86_64 2.3.1-11.el7 rhel-x86_64-server-7 55 k
        Installing for dependencies:
        unixODBC x86_64 2.3.1-11.el7 rhel-x86_64-server-7 413 k

        Transaction Summary
        =============================================================================================================================================================
        Install 3 Packages (+1 Dependent package)

        Total size: 4.6 M
        Total download size: 4.1 M
        Installed size: 5.5 M
        Is this ok [y/d/N]: y
        Downloading packages:
        (1/2): mssql-tools-14.0.3.0-1.x86_64.rpm | 248 kB 00:00:00
        (2/2): msodbcsql-13.1.4.0-1.x86_64.rpm | 3.9 MB 00:00:01
        ————————————————————————————————————————————————————-
        Total 3.0 MB/s | 4.1 MB 00:00:01
        Running transaction check
        Running transaction test
        Transaction test succeeded
        Running transaction
        Installing : unixODBC-2.3.1-11.el7.x86_64 1/4
        Installing : msodbcsql-13.1.4.0-1.x86_64 2/4
        Installing : mssql-tools-14.0.3.0-1.x86_64 3/4
        Installing : unixODBC-devel-2.3.1-11.el7.x86_64 4/4
        Verifying : unixODBC-devel-2.3.1-11.el7.x86_64 1/4
        Verifying : unixODBC-2.3.1-11.el7.x86_64 2/4
        Verifying : msodbcsql-13.1.4.0-1.x86_64 3/4
        Verifying : mssql-tools-14.0.3.0-1.x86_64 4/4

        Installed:
        msodbcsql.x86_64 0:13.1.4.0-1 mssql-tools.x86_64 0:14.0.3.0-1 unixODBC-devel.x86_64 0:2.3.1-11.el7

        Dependency Installed:
        unixODBC.x86_64 0:2.3.1-11.el7

        Complete!
        [root@sldsnpl01 ~]#

        # I tested bcp and it works.

      2. Meet Bhagdev says:

        That’s great news! Thanks for verifying.

  4. BK says:

    We down loade below files 3 files from “https://packages.microsoft.com/rhel/7/prod/”

    msodbcsql-13.1.4.0-1
    mssql-tools-14.0.3.0-1
    unixODBC-utf16-2.3.1-1.x86_64.rpm

    BCP commands used:
    export PATH=$PATH:/opt/mssql-tools/bin
    export PATH=$PATH:/opt/mssql-tools/bin
    /opt/mssql-tools/bin/bcp DB_NAME.dbo.Test_Table out /tmp/bcp_out.txt -S Server_name -U login_Name -P Password -c -t”,”

    after above statement, BCP execution getting “Memory Fault” message.
    There is no output file like /tmp/bcp_out.txt

    SQLCMD working fine and have issue with BCP command.Please advise.

    Is this bug or is something we are missing.

    1. BK says:

      This on Red hat 7.3 server

    2. Meet Bhagdev says:

      Seems like a BCP bug. Can you file a connect issue with your legs and repro steps: https://connect.microsoft.com/ and send an email to meetb@microsoft.com

      1. sqldba says:

        This issue fixed with new RPM of “03-Feb-2017” release.

        thanks

      2. Meet Bhagdev says:

        Thanks for verifying 🙂

Skip to main content