{"id":18905,"date":"2017-02-08T09:00:00","date_gmt":"2017-02-08T17:00:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/dataplatforminsider\/?p=18905"},"modified":"2024-01-22T22:50:43","modified_gmt":"2024-01-23T06:50:43","slug":"odbc-driver-13-1-for-linux-released","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2017\/02\/08\/odbc-driver-13-1-for-linux-released\/","title":{"rendered":"ODBC Driver 13.1 for Linux Released"},"content":{"rendered":"
This post is authored by Meet Bhagdev, Program Manager, Microsoft<\/p>\n
Hi all. We are delighted to share the Production Ready Release of the Microsoft ODBC Driver 13.1 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.\n<\/p>\n
sudo su <\/span> sudo su <\/span> sudo su <\/span> sudo su<\/span> sudo su<\/span> sudo su <\/span> 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:<\/p>\n wget “https:\/\/raw.githubusercontent.com\/Microsoft\/sql-server-samples\/master\/samples\/tutorials\/c\/linux\/sample_c_linux.c”<\/span> If you installed the driver using the manual instructions found here<\/a>, 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.<\/p>\n Please fill bugs\/questions\/issues on our Issues <\/a>page. We welcome contributions\/questions\/issues of any kind. Happy programming!<\/p>\n Meet Bhagdev (meetb@microsoft.com<\/a>)<\/p>\n
\ncurl https:\/\/packages.microsoft.com\/keys\/microsoft.asc | apt-key add –<\/span>
\ncurl https:\/\/packages.microsoft.com\/config\/ubuntu\/15.10\/prod.list > \/etc\/apt\/sources.list.d\/mssql-release.list<\/span>
\nexit<\/span>
\nsudo apt-get update<\/span>
\nsudo ACCEPT_EULA=Y apt-get install msodbcsql=13.1.4.0-1<\/span>
\nsudo apt-get install unixodbc-dev<\/span><\/p>\nInstall the ODBC Driver for Linux on Ubuntu 16.04<\/h2>\n
\ncurl https:\/\/packages.microsoft.com\/keys\/microsoft.asc | apt-key add –<\/span>
\ncurl https:\/\/packages.microsoft.com\/config\/ubuntu\/16.04\/prod.list > \/etc\/apt\/sources.list.d\/mssql-release.list<\/span>
\nexit<\/span>
\nsudo apt-get update<\/span>
\nsudo ACCEPT_EULA=Y apt-get install msodbcsql=13.1.4.0-1<\/span>
\nsudo apt-get install unixodbc-dev<\/span><\/p>\nInstall the ODBC Driver for Linux on Ubuntu 16.10<\/h2>\n
\ncurl https:\/\/packages.microsoft.com\/keys\/microsoft.asc | apt-key add –<\/span>
\ncurl https:\/\/packages.microsoft.com\/config\/ubuntu\/16.10\/prod.list > \/etc\/apt\/sources.list.d\/mssql-release.list<\/span>
\nexit<\/span>
\nsudo apt-get update<\/span>
\nsudo ACCEPT_EULA=Y apt-get install msodbcsql=13.1.4.0-1<\/span>
\nsudo apt-get install unixodbc-dev<\/span><\/p>\nInstall the ODBC Driver for Linux on RedHat 6<\/h2>\n
\ncurl https:\/\/packages.microsoft.com\/config\/rhel\/6\/prod.repo > \/etc\/yum.repos.d\/mssql-release.repo<\/span>
\nexit<\/span>
\nsudo yum remove unixODBC-utf16 unixODBC-utf16-devel #to avoid conflicts<\/span>
\nsudo ACCEPT_EULA=Y yum install msodbcsql-13.1.4.0-1<\/span>
\nsudo yum install unixODBC-devel<\/span><\/p>\nInstall the ODBC Driver for Linux on RedHat 7<\/h2>\n
\ncurl https:\/\/packages.microsoft.com\/config\/rhel\/7\/prod.repo > \/etc\/yum.repos.d\/mssql-release.repo<\/span>
\nexit<\/span>
\nsudo yum remove unixODBC-utf16 unixODBC-utf16-devel #to avoid conflicts<\/span>
\nsudo ACCEPT_EULA=Y yum install msodbcsql-13.1.4.0-1<\/span>
\nsudo yum install unixODBC-devel<\/span><\/p>\nInstall the ODBC Driver for SLES 12<\/h2>\n
\nzypper ar https:\/\/packages.microsoft.com\/config\/sles\/12\/prod.repo <\/span>
\nzypper update<\/span>
\nexit <\/span>
\nsudo ACCEPT_EULA=Y zypper install msodbcsql-13.1.4.0-1<\/span>
\nsudo zypper install unixODBC-devel<\/span><\/p>\nTry Our Sample<\/h2>\n
\ngcc sample_c_linux.c -o sample_c_linux -lodbc -w #make sure you change the servername, username and password in the connections string<\/span>
\n.\/sample_c_linux<\/span><\/p>\n