We will see how to install and use tools to manage your SQL Servers. We will use the version 13, who is compatible with Ubuntu. You can use these drivers from SQL Server 2008 to 2016, and it’s compatible with Azure SQL Database too.

To start, install prerequisites that will be necessary to install the sqlcmd on Linux:

sudo apt-get -y install libc6 libkrb5-3 libgss3 e2fsprogs openssl libssl-dev libssl1.0.0 libssl1.0.0-dbg make 1 sudo apt - get - y install libc6 libkrb5 - 3 libgss3 e2fsprogs openssl libssl - dev libssl1 . 0.0 libssl1 . 0.0 - dbg make

We will download and install Microsoft ODBC Drivers for SQL Server for Linux:

wget https://download.microsoft.com/download/2/E/5/2E58F097-805C-4AB8-9FC6-71288AB4409D/msodbcsql-13.0.0.0.tar.gz sudo tar -xvzf msodbcsql-13.0.0.0.tar.gz 1 2 wget https : //download.microsoft.com/download/2/E/5/2E58F097-805C-4AB8-9FC6-71288AB4409D/msodbcsql-13.0.0.0.tar.gz sudo tar - xvzf msodbcsql - 13.0.0.0.tar.gz

Move in the folder that you extracted. You will have a file named build_dm.sh. This file will download and compile ODBC drivers, in version 12.3.1:

cd msodbcsql-13.0.0.0/ ls –l 1 2 cd msodbcsql - 13.0.0.0 / ls – l

Execute it with the following command to download drivers and do the compilation. Answer YES to the question to accept the license:

sudo ./build_dm.sh 1 sudo . / build_dm . sh

As it’s indicated, to finish the installation, you have to execute the command

cd /tmp/unixODBC.21454.32315.4074/unixODBC-2.3.1; make install: 1 cd / tmp / unixODBC . 21454.32315.4074 / unixODBC - 2.3.1 ; make install :

To do this, you have to be root. I will move to root, with the command

sudo –i: 1 sudo – i :

And launch the command:

cd /tmp/unixODBC.21454.32315.4074/unixODBC-2.3.1; make install 1 cd / tmp / unixODBC . 21454.32315.4074 / unixODBC - 2.3.1 ; make install

By default, libraries are installed in /usr/lib64. Exit root with the exit command.

We will now launch the installation of ODBC Drivers for SQL Server. Execute the following command to save the file odbcinst.ini:

ODBCINSTINI=$(odbc_config --odbcinstini) sudo cp ${ODBCINSTINI} ${ODBCINSTINI}.bck 1 2 ODBCINSTINI = $ ( odbc_config -- odbcinstini ) sudo cp $ { ODBCINSTINI } $ { ODBCINSTINI } . bck

Before starting the installation, we will verify that all prerequisites are installed correctly:

./install.sh verify 1 . / install . sh verify

All is fine, we can start the installation with the following command :

sudo ./install.sh install --accept-license 1 sudo . / install . sh install -- accept - license

Before using the tool sqlcmd, we need to verify that the /ust/lib64 folder is referenced in the ld.so.conf file:

cat /etc/ld.so.conf 1 cat / etc / ld . so . conf

If, like me, you don’t have /usr/lib64, you need to add it:

sudo vim /etc/ld.so.conf 1 sudo vim / etc / ld . so . conf

Execute the following command to reload the configuration file that we just modified:

sudo ldconfig 1 sudo ldconfig

You can verify that the installation is complete with the following command:

odbcinst -q -d -n "ODBC Driver 13 for SQL Server" 1 odbcinst - q - d - n "ODBC Driver 13 for SQL Server"

StarWind HyperConverged Appliance is a turnkey, entirely software-defined hyperconverged platform purpose-built for intensive virtualization workloads. Bringing the desired performance and reducing downtime, the solution can be deployed by organizations with limited budgets and IT team resources. Also, it requires only one onsite node to deliver HA for your applications that make the solution even more cost-efficient. Find out more about ➡ StarWind HyperConverged Appliance

You can connect to your SQL Server to do requests, with the command:

sqlcmd –S sqlserver.fqdn.local|instancename -Q "SELECT name FROM sys.databases" -U sa 1 sqlcmd – S sqlserver . fqdn . local | instancename - Q "SELECT name FROM sys.databases" - U sa

I have a problem for the authentication with my Active Directory account, by using the Windows authentication:

Then on the SQL Server, I don’t have any problem:

I will update this post when I will find the problem.

Enjoy 🙂

Related materials:

Views All Time Views All Time 1 Views Today Views Today 5

Appreciate how useful this article was to you? No Ratings Yet

No Ratings Yet

Loading... Loading...