Install the ODBC Driver on Linux

To use the Denodo ODBC driver on Linux/Unix you have to compile its source code. The subsections below explain how to do it.

Pre-requisites to Compile the ODBC Driver on Linux

The Denodo ODBC driver depends on the following packages and versions:

  1. “gcc”
  2. “postgresql-devel” version >= 9.x (in some Linux distributions, it is called “postgresql-server-dev-9.3”).
  3. “unixODBC” version >= 2.2.14
  4. “unixODBC-devel” version >= 2.2.14 (in some Linux distributions, it is called “unixodbc-dev”).
  5. “openssl-devel” (in some Linux distributions, it is called “libssl-dev”): you only need this package if you want the ODBC driver to support Kerberos authentication.

Before compiling the ODBC driver, check that they are installed in the host where you are compiling the driver:

For Linux distributions based on RPM packaging system such as CentOS:

  • Check that all the packages listed above are installed. To do this, execute yum list installed <package name>. For example,

    yum list installed gcc postgresql-devel unixODBC unixODBC-devel openssl-devel
    

    You should see something like

    Installed Packages
    gcc.x86_64                                                     4.8.2-16.2.el7_0
    openssl-devel.x86_64                                            1:1.0.1e-60.el7
    postgresql-devel.x86_64                                            9.2.18-1.el7
    unixODBC.x86_64                                                    2.3.1-11.el7
    unixODBC-devel.x86_64                                              2.3.1-11.el7
    

    Check that the five packages are installed and that the version of the package meets the requirements. If a package is not listed, it means that you have to install it.

  • To install a package, execute the command yum install <package name>. For example,

    sudo yum install openssl-devel
    

    If this returns “No package … available.”, it means that in this particular distribution, the package is named differently. In this case, search the name of the package with the command yum list available <package name>. For example,

    yum list available *openssl-devel*
    

    Note the parameter includes an asterisk. That is because you can pass a pattern and not just an exact name.

    At least one package should come up. Copy the name and install it with yum install <package name>.


For Linux distributions based on the Debian packaging system like Ubuntu:

  • Check that all the packages listed above are installed. To do this, execute apt list --installed <package name>. For example,

    apt list --installed gcc postgresql-server-dev-9.3 unixODBC unixodbc-dev libssl-dev
    

    You should see something like

    Listing... Done
    gcc/trusty,now 4:4.8.2-1ubuntu6 amd64 [installed]
    libssl-dev/trusty-updates,trusty-security,now 1.0.1f-1ubuntu2.22 amd64 [installed]
    postgresql-server-dev-9.3/trusty-updates,now 9.3.17-0ubuntu0.14.04 amd64 [installed]
    unixodbc/trusty,now 2.2.14p2-5ubuntu5 amd64 [installed]
    unixodbc-dev/trusty,now 2.2.14p2-5ubuntu5 amd64 [installed]
    

    Check that the five packages are installed and that the version of the package meets the requirements. If a package is not listed, it means that you have to install it.

    Note that the package names are different than the ones listed when talking about RPM-based distributions. The reason is that in many Debian-based distributions, the package names are different.

  • If a package is not installed, install it with the command apt-get install <package name>. For example,

    sudo apt-get install unixODBC
    

    If this returns “Unable to locate package <package name>”, it means that in this particular distribution, the package is named differently. In this case, search the name of the package with the command apt list <package name>. For example,

    apt list *unixODBC*
    

    Note the parameter includes an asterisk. That is because you can pass a pattern and not just an exact name.

    At least one package should come up. Copy the name and install it with apt-get install <package name>.

Note

If you do not have privileges to execute sudo, type su, press Enter and provide the “root” password. You will be the root user for the duration of the session.

Compile the ODBC Driver (Standard Method)

This section explains how to compile the Denodo ODBC driver. Open a command line and execute the commands below.

Note

If you need to connect to a Denodo server with Kerberos authentication and at least one of the JDBC data sources in Denodo uses pass-through session credentials, do not follow the instructions of this section. Instead, go to the section below.

# Important: in the line below, replace "<DENODO_HOME>" with the path to the
# Denodo installation.

export DENODO_HOME=<DENODO_HOME>

cd $DENODO_HOME/tools/client-drivers/odbc
tar -xzf DenodoODBC_src.tar.gz
cd denodoodbc-09.0*
./configure --prefix=$DENODO_HOME/tools/client-drivers/odbc
make install

The driver is now compiled. It is located in “<DENODO_HOME>/tools/client-drivers/odbc/lib”.

Continue to the section Set Up a DSN on Linux and Other UNIX.

If ./configure or make failed because of missing dependencies, go to the section Troubleshooting the Compilation of the Denodo ODBC Driver. For example, if ./configure failed with this error:

configure: error: odbc_config not found (required for unixODBC build)

Compile the ODBC Driver to Obtain Forwardable Tickets

This section explains how to compile the Denodo ODBC driver so it can obtain “forwardable” Kerberos tickets. This is necessary if you need to use Kerberos authentication and at least one of the JDBC data sources in Denodo uses pass-through session credentials. You will be able to use this driver for login/password authentication as well.

This process is more convoluted because you need to apply a patch over the libpq library of the PostgreSQL database. If you do not need this feature, follow the steps of the section above.

Open a command line and execute these commands:

# Important: in the line below, replace "<DENODO_HOME>" with the path to the
# Denodo installation.

export DENODO_HOME=<DENODO_HOME>

cd $DENODO_HOME/tools/client-drivers/odbc

# Downloading the source code of PostgreSQL
wget https://ftp.postgresql.org/pub/source/v9.5.3/postgresql-9.5.3.tar.gz

tar -xzf postgresql-9.5.3.tar.gz
tar -xzf DenodoODBC_src.tar.gz

# The file "DenodoODBC_src.tar.gz" includes a patch that modifies the
# libpq library of PostgreSQL so the Kerberos authentication works
# with Denodo.
cd postgresql-9.5.3
patch ./src/interfaces/libpq/fe-auth.c ./libpq.patch

./configure --with-krb-srvnam=HTTP --with-openssl --without-readline --prefix=$DENODO_HOME/tools/client-drivers/odbc/libpq
cd src/interfaces/libpq
make install

cd $DENODO_HOME/tools/client-drivers/odbc/denodoodbc-09*
./configure --with-libpq=$DENODO_HOME/tools/client-drivers/odbc/libpq/lib --prefix=$DENODO_HOME/tools/client-drivers/odbc
make install

The driver is now compiled. It is located in “<DENODO_HOME>/tools/client-drivers/odbc/lib”.

Continue to the section Set Up a DSN on Linux and Other UNIX.

If ./configure or make failed because of missing dependencies, go to the section below. For example, if ./configure failed with this error:

configure: error: odbc_config not found (required for unixODBC build)

Troubleshooting the Compilation of the Denodo ODBC Driver

If you find any problems during the compilation of the Denodo ODBC driver, try the following:

  1. Check that the packages required by the Denodo ODBC driver are installed, including its version.
  2. If they are correct, try compiling manually the packages UnixODBC and PostgreSQL-devel. To do this, execute the following commands:

Compile libpq module of the “PostgreSQL-devel” library.

# Important: in the line below, replace "<DENODO_HOME>" with the path to the
# Denodo installation.

export DENODO_HOME=<DENODO_HOME>

cd $DENODO_HOME

cd tools/client-drivers/odbc
wget https://ftp.postgresql.org/pub/source/v9.5.3/postgresql-9.5.3.tar.gz
tar -xzf postgresql-9.5.3.tar.gz
cd postgresql-9.5.3
./configure --with-krb-srvnam=HTTP --with-openssl --without-readline --prefix=$DENODO_HOME/tools/client-drivers/odbc/libpq
cd src/interfaces/libpq
make install

Compile UnixODBC

cd $DENODO_HOME

cd tools/client-drivers/odbc
wget http://www.unixodbc.org/unixODBC-2.3.4.tar.gz
tar -xzf unixODBC-2.3.4.tar.gz
cd unixODBC-2.3.4
./configure
make install

Compile the Denodo ODBC driver again using the libpq library compiled above

cd $DENODO_HOME/tools/client-drivers/odbc
rm --recursive --force denodoodbc*
tar -xzf DenodoODBC_src.tar.gz
cd $DENODO_HOME/tools/client-drivers/odbc/denodoodbc-09*
./configure --with-libpq=$DENODO_HOME/tools/client-drivers/odbc/libpq/lib --prefix=$DENODO_HOME/tools/client-drivers/odbc
make install

If none of these commands fail, the driver should now be in “<DENODO_HOME>/tools/client-drivers/odbc/lib”.