ODBC Driver 13.1 for Linux Preview 1 Released


Hi all, we are delighted to share the first preview release of the Microsoft ODBC Driver 13.1 for Linux –  (Ubuntu, RedHat and SUSE). The preview release adds new features, has bug fixes and enables access to SQL Server, Azure SQL Database and Azure SQL Data Warehouse from any C/C++ application on Linux. 

What’s new

  • Bulk Copy API Support
    • You can use functions through the ODBC driver as described here on Linux
  • Support for user defined KeyStoreProvider for Always Encrypted
    • You can now user defined/created AE Column Master Key keystore providers. Check out code samples and more information here.

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.1.1.0-1 
sudo apt-get install unixodbc-dev-utf16 #this step is optional but recommended*

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.1.1.0-1 
sudo apt-get install unixodbc-dev-utf16 #this step is optional but recommended*

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.1.1.0-1 
sudo yum install unixODBC-utf16-devel #this step is optional but recommended*

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.1.1.0-1
sudo yum install unixODBC-utf16-devel #this step is optional but recommended*

Install the ODBC Driver for Linux on SUSE 12

sudo su 
zypper ar https://packages.microsoft.com/config/sles/12/prod.repo 
zypper update 
sudo ACCEPT_EULA=Y zypper install msodbcsql-13.1.1.0-1
zypper install unixODBC-utf16-devel

Note: Packages for SQL Server Command Line tools v13.1 will be available soon. The above mentioned packages only install the ODBC Driver for SQL Server that enable connectivity from any C/C++ application. To install and use the SQL Server Command Line tools, check out the instructions here: https://blogs.msdn.microsoft.com/sqlnativeclient/2016/10/20/odbc-driver-13-0-for-linux-released/

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 file 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 PHPJDBC and ADO.NET which are already available.

Meet Bhagdev (meetb@microsoft.com)

 

sql-loves-linux_2_twitter-002

Comments (14)

    1. Meet Bhagdev says:

      Hi Slava, definitely!

  1. Mark Songhurst says:

    You appear to have an RPM dependency issue on unixODBC with this release.
    This is the output from when a perform a yum update on CentOS 7 against the appropriate rhel/7/prod repository

    Resolving Dependencies
    –> Running transaction check
    —> Package msodbcsql.x86_64 0:13.1.1.0-1 will be updated
    —> Package msodbcsql.x86_64 0:13.1.3.0-1 will be an update
    –> Processing Dependency: unixODBC >= 2.3.1 for package: msodbcsql-13.1.3.0-1.x86_64
    –> Running transaction check
    —> Package unixODBC.x86_64 0:2.3.1-11.el7 will be installed
    –> Processing Conflict: unixODBC-utf16-2.3.1-1.x86_64 conflicts unixODBC
    –> Processing Conflict: msodbcsql-13.1.3.0-1.x86_64 conflicts unixODBC-utf16
    –> Finished Dependency Resolution
    Error: unixODBC-utf16 conflicts with unixODBC-2.3.1-11.el7.x86_64
    Error: msodbcsql conflicts with unixODBC-utf16-2.3.1-1.x86_64

    It looks to me like msodbcsql has a dependency on unixODBC
    However, your optional but recommended (and therefore i’m going to want to install it!) step to install unixODBC-utf16-devel
    This fails because unixODBC-utf16 has an RPM conflict on unixODBC – you can’t have unixODBC and unixODBC-utf16 installed on the same system, they clash.

    Here are my condensed results from using rpm on the available RPM files:
    # rpm -qpR msodbcsql-13.1.3.0-1.x86_64.rpm
    unixODBC >= 2.3.1

    # rpm -qpR unixODBC-utf16-devel-2.3.1-1.x86_64.rpm
    unixODBC-utf16(x86-64) = 2.3.1-1

    # rpm -qp –conflicts unixODBC-utf16-2.3.1-1.x86_64.rpm
    unixODBC

    As a further request, maybe you could put preview releases in a separate repository to stable releases? That way on production systems we can run a yum update with some confidence that we’re only going to be querying the versions of known stable releases.
    Personally I would create a rhel/7/preview repository.

    Thanks.

    1. Meet Bhagdev says:

      Hello Mark,

      With the latest packages on the repository (13.1.3) we removed the dependency on the custom unixODBC Driver manager (utf16). We now depend on the unixODBC Driver Manager that ships out of the box. Can you try these steps and let me know if you are running into issues:

      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-utf16 unixODBC-utf16-devel #to avoid conflicts
      sudo ACCEPT_EULA=Y yum install msodbcsql-13.1.3.0-1
      sudo yum install unixODBC-devel #this step is optional but recommended*

      And yes, we will look into using preview repositories going forward 🙂

      1. Mark Songhurst says:

        Hi Meet

        I can confirm that I can now install msodbcsql 13.1.3 with the regular unixODBC package from CentOS 7 base repository (2.3.1-11.el7).
        To prevent other users having the same issues as I did, please can you update the CentOS 7 instructions in the post?
        Many thanks.

      2. Juraj Bocinec says:

        Greetings, the installation of msodbcsql package was successful, however the optional step for unixODBC-utf16-devel still gets dependency conflicts:

        lv422039 ~ # yum install unixODBC-utf16-devel
        Loaded plugins: product-id, search-disabled-repos, subscription-manager
        This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
        Resolving Dependencies
        –> Running transaction check
        —> Package unixODBC-utf16-devel.x86_64 0:2.3.1-1 will be installed
        –> Processing Dependency: unixODBC-utf16(x86-64) = 2.3.1-1 for package: unixODBC-utf16-devel-2.3.1-1.x86_64
        –> Running transaction check
        —> Package unixODBC-utf16.x86_64 0:2.3.1-1 will be installed
        –> Processing Conflict: msodbcsql-13.1.4.0-1.x86_64 conflicts unixODBC-utf16
        –> Processing Conflict: unixODBC-utf16-2.3.1-1.x86_64 conflicts unixODBC
        –> Finished Dependency Resolution
        Error: unixODBC-utf16 conflicts with unixODBC-2.3.1-11.el7.x86_64
        Error: msodbcsql conflicts with unixODBC-utf16-2.3.1-1.x86_64
        You could try using –skip-broken to work around the problem
        You could try running: rpm -Va –nofiles –nodigest

      3. Meet Bhagdev says:

        @Juraj, we no longer need the devel packages. The default ones that ship with the OS are sufficient. Do the following to install unixODBC-devel:
        yum install unixODBC-devel

  2. Markus says:

    Hi,
    When will the known issue “String data, right truncation” regarding utf-8 characters and text/varchar datatypes be fixed? Where can I configure the value of “BufferLength in ColumnSize” as described here: https://msdn.microsoft.com/en-us/library/hh568448(v=sql.110).aspx
    Thanks,
    Markus

    1. Meet Bhagdev says:

      Hi Markus, we are still looking into this. This has a dependency on the unixODBC Driver Manager and we have not been able to find a fix for it yet.

  3. JPQuinn says:

    I installed the ODBC 13.1 driver into Ubuntu 16.04. Before installing, I would connect to SQL Server with a command line: sqlcmd -S localhost -U SA -P ‘password’ with no issues. The new driver would come in through a software update, and fail due to the EULA not being OK’s, so I used this sites nice info to get it done manually. That went successfully. Now when I run the connect command in a terminal window, sqlcmd: Command not found. So how am I to connect to the Linux SQL Server at this point? Please let me know. Thanks

    1. JPQuinn says:

      Can someone please address this issue? I followed the above, and now I cant connect with term command line to SQL Server Linux anymore

    2. Meet Bhagdev says:

      Hi JPQuinn, did you add sqlcmd and bcp to the path?
      echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
      echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
      source ~/.bashrc

  4. Nancy says:

    The SQLCMD tool that came with v13.1 preview was removed from the ODBC 13.1.1 GA version. Where can I download the sqlcmd for ODBC Driver 13.1.1?

    1. Meet Bhagdev says:

      Hi Nancy, you can download the sqlcmd v14 binaries through the same repo using apt-get install mssql-tools

Skip to main content