How to install ODBC on Ubuntu 20.04 / Debian 11?

Many applications need to relate to database or spreadsheet files. For the process to be adequate, it is necessary to have an application that serves as a connector between the two. So today I will show you how to install ODBC on Ubuntu 20.04 / Debian 11 which is one of the most popular.

What is ODBC?

ODBC stands for Open Database Connectivity, it is a standard implementation of database access used by Microsoft systems.

This means that any application to connect to a Windows database must have its own ODBC connector. A sample of it is MySQL that has a connector based on ODBC so that we can use it in applications created for Windows.

Another example is that Microsoft’s Access (Microsoft Jet) and SQL Server databases also have their ODBC driver. The difference of these is that it is already installed by default in the system and only the applications have to connect using this driver.

Although it is closely related to Windows, we have fully functional versions for Linux and other systems. This can be done using UnixODBC.

If you don’t know what is UnixODBC, we can start from the definition that we find in their website:

The unixODBC Project goals are to develop and promote unixODBC to be the definitive standard for ODBC on non MS Windows platforms.

So, we will be able to install ODBC on Ubuntu 20.04 / Debian 11 without much trouble thanks to the above project.

Let’s go for it.

Install ODBC on Ubuntu 20.04 / Debian 11

ODBC is not included in the repositories of both distributions. However, a fairly convenient way to install it is to compile the source code ourselves. The process is not complex and will provide us with the latest stable version.

Install the packages to compile the programs

First open a terminal from the main menu and update the whole distribution.

sudo apt update
sudo apt upgrade

Then install the packages needed for compiling and creating binaries.

sudo apt install build-essential

Download and install ODBC on Ubuntu 20.04 / Debian 11

Then, we can download the latest stable version of ODBC. It is currently 2.3.9. It is necessary to verify in this link which is the latest version and modify the command.

To download the source package, we can use wget which also handles downloads using FTP.

wget ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.9.tar.gz

Then, unzip the archive thanks to the tar command.

tar xvzf unixODBC-2.3.9.tar.gz

Access the folder that has been generated

cd unixODBC-2.3.9/

And from there start configuring the package.

./configure --prefix=/usr/local/unixODBC

Then, compile it

make

Finally, install it on the system by running

sudo make install

To check the installation, you have to navigate to the /usr/local/unixODBC folder, where you will see the binaries.

cd /usr/local/unixODBC/bin
ls
ODBC on Ubuntu 20.04 / Debian 11
ODBC on Ubuntu 20.04 / Debian 11

As you can see, the binaries are installed and ready to use.

Conclusion

ODBC is an important part of establishing connections in Microsoft systems and programs but thanks to the UnixODBC project we can have it in our favorite distribution.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top