Hi, folks. In this post, you will learn how to install ODBC on Ubuntu 20.04 / Debian 10 through a free implementation. If you use this database access API a lot, it will serve you well.
In a few words, ODBC is an open specification for providing application developers with a predictable API with which to access Data Sources. Data Sources include SQL Servers and any Data Source with an ODBC Driver.
With the need for an open-source implementation and compatibility with other operating systems, unixODBC was born. This project also has a graphical interface that you can use but its potential is in the binaries that offer compatibility with this implementation.
So, let’s go for it.
Installing ODBC on Ubuntu 20.04 / Debian 10
Note: The screenshots are from version 2.3.7 but the post has been updated to the latest version which is 2.3.9. Don’t Worry.
Upgrading the system completely is the first step in performing this tutorial.
So, open a terminal and run the following commands:
:~$ sudo apt update
:~$ sudo apt upgrade
Once the installation has been completed, all the basic tools for compiling and building packages must be installed. This can easily be done with the following command:
:~$ sudo apt install build-essential [sudo] password for angelo: Reading package lists… Done Building dependency tree Reading state information… Done The following additional packages will be installed: binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-9 dpkg-dev fakeroot g++ g++-9 gcc gcc-9 gcc-9-base libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-9-dev libgomp1 libisl22 libitm1 liblsan0 libmpc3 libquadmath0 libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev make manpages-dev Suggested packages: binutils-doc cpp-doc gcc-9-locales debian-keyring g++-multilib g++-9-multilib gcc-9-doc gcc-multilib autoconf automake libtool flex bison gdb gcc-doc gcc-9-multilib glibc-doc bzr libstdc++-9-doc make-doc The following NEW packages will be installed: binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-9 dpkg-dev fakeroot g++ g++-9 gcc gcc-9 gcc-9-base libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-9-dev libgomp1 libisl22 libitm1 liblsan0 libmpc3 libquadmath0 libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev make manpages-dev 0 upgraded, 41 newly installed, 0 to remove and 0 not upgraded. Need to get 39.9 MB of archives. After this operation, 175 MB of additional disk space will be used. Do you want to continue? [Y/n]
This will install all the dependencies we need to install unixODBC on Ubuntu 20.04 / Debian 10
The next step is to download the unixODBC source code file. At the time of writing, the latest stable version is 2.3.9
:~$ wget ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.9.tar.gz --2021-07-05 17:32:20-- ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.9.tar.gz => ‘unixODBC-2.3.9.tar.gz’ Resolving ftp.unixodbc.org (ftp.unixodbc.org)… 18.104.22.168 Connecting to ftp.unixodbc.org (ftp.unixodbc.org)|22.214.171.124|:21… connected. Logging in as anonymous … Logged in! ==> SYST … done. ==> PWD … done. ==> TYPE I … done. ==> CWD (1) /pub/unixODBC … done. ==> SIZE unixODBC-2.3.9.tar.gz … 1676145 ==> PASV … done. ==> RETR unixODBC-2.3.9.tar.gz … done. Length: 1676145 (1.6M) (unauthoritative) unixODBC-2.3.9.tar.gz 100%[=====================================================================================>] 1.60M 5.31MB/s in 0.3s 2021-07-05 17:32:21 (5.31 MB/s) - ‘unixODBC-2.3.9.tar.gz’ saved 
Then decompress the generated file and go to the unixODBC folder.
:~$ tar xvzf unixODBC-2.3.9.tar.gz :~$ cd unixODBC-2.3.9/
There you prepare the file for compilation:
:~$ ./configure --prefix=/usr/local/unixODBC
Then, using the make command to create the package
And finally, install it on the system by running the following command:
:~$ sudo make install
When the process is finished you can go to the
/usr/local/unixODBC/bin folder and see all the binaries that have been installed.
:~$ cd /usr/local/unixODBC/bin/ :~$ ls
So unixODBC is ready for battle. You can now implement it and connect to various databases such as those made in Microsoft SQL Server.
The implementation of ODBC on Unix systems is done by unixODBC with the guarantee of being opensource and quite stable. It’s a very interesting database project that can be very useful to many professionals. So in this post, I’ve shown you how to install it from the source code.
Please share this post and join our Telegram channel.