Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More

How to Install PostgreSQL ODBC client on Linux for PostgreSQL Target Endpoint

100% helpful (1/1)
cancel
Showing results for 
Search instead for 
Did you mean: 
john_wang
Support
Support

How to Install PostgreSQL ODBC client on Linux for PostgreSQL Target Endpoint

Last Update:

May 3, 2024 6:08:04 AM

Updated By:

john_wang

Created date:

May 3, 2024 6:08:04 AM

This article provides a comprehensive guide to efficiently install the PostgreSQL ODBC client on Linux for a PostgreSQL target endpoint.

If the PostgreSQL serves as Replicate source endpoint, please check: How to Install PostgreSQL ODBC client on Linux for PostgreSQL Source Endpoint

Overview

  1. Download the PostgreSQL ODBC client software.
  2. Upload the downloaded files to your Replicate Linux Server.
  3. Install the RPM files in the specified order.
  4. Take note of considerations or setup instructions during the installation process.

Steps

  1. Download the PostgreSQL ODBC client software

    Please choose the appropriate version of the PostgreSQL client software and the corresponding folder for your Linux operating system. In this article, we are installing PostgreSQL ODBC Client version 13.2 on Linux 8.5.

  2. Upload the downloaded files to a temporary folder in your Qlik Replicate Linux Server

  3. Install the RPM files in the specified order  
    rpm -ivh postgresql13-libs-13.2-1PGDG.rhel8.x86_64.rpm
    rpm -ivh postgresql13-odbc-13.02.0000-1PGDG.rhel8.x86_64.rpm
    rpm -ivh postgresql13-13.2-1PGDG.rhel8.x86_64.rpm
  4. Take note of considerations or setup instructions during the installation process.
    1. Note the installation folder (default: "/usr/pgsql-13/lib")
    2. Open site_arep_login.sh in /opt/attunity/replicate/bin/ and add the installation folder as a LD_LIBRARY_PATH
      export LD_LIBRARY_PATH=/usr/pgsql-13/lib:$LD_LIBRARY_PATH
    3. Save the site_arep_login.sh file and restart Replicate Services.

  5. unixODBC is a prerequisite. If it's not already present on your Linux Server, make sure to install it before PostgreSQL ODBC client software installation:
    rpm -ivh unixODBC-2.3.7-1.el8.x86_64.rpm
  6. "/etc/odbcinst.ini" is required:  
    [PostgreSQL]
    Description = ODBC for PostgreSQL
    Driver = /usr/lib/psqlodbcw.so
    Setup = /usr/lib/libodbcpsqlS.so
    Driver64 = /usr/pgsql-13/lib/psqlodbcw.so
    Setup64 = /usr/lib64/libodbcpsqlS.so
    FileUsage = 1

  7. "psql" is required if the task set to Batch optimized apply mode.

  8. "/etc/odbc.ini" is optional and typically not required, unless it becomes necessary for troubleshooting connectivity issues by "isql".A sample:  
    [pg15]
    Driver = /usr/pgsql-13/lib/psqlodbcw.so
    Database = targetdb
    Servername = <targetDBHostName or IP Address>
    Port = 5432
    UserName = <PG User Name>
    Password = <PG user's Password>

Environment

  • Qlik Replicate all versions
  • PostgreSQL Server all versions
  • PostgreSQL Client version 13.2

Qlik Replicate 

Comments
Erdem
Partner - Contributor
Partner - Contributor

Thank you @john_wang .

In my case, while testing the ODBC connection, I encountered the following error. This may have been caused by the collation settings of my PostgreSQL database or the fact that my RHEL 9 locale was set to tr-tr or I have installed rpm packages with different versions rather than you specified:

Error Message:

RetCode: SQL_ERROR SqlState: 01000 NativeError: 0 Message: [unixODBC][Driver Manager]Can't open lib 'PostgreSQL Unicode(x64)' : file not found
I Installed all the packages with the latest version specific to RHEL 9.4

I downloaded and installed the latest PostgreSQL ODBC drivers compatible with RHEL 9. (Links may get outdated soon, try to find the latest ones)

The following commands were used:

Installing the packages:

sudo rpm -ivh postgresql13-libs-13.16-2PGDG.rhel9.x86_64.rpm
sudo rpm -ivh postgresql13-odbc-13.02.0000-2PGDG.rhel9.x86_64.rpm
# solved dependency error with installing the default unixODBC:
sudo yum install unixODBC
sudo rpm -ivh postgresql13-odbc-13.02.0000-2PGDG.rhel9.x86_64.rpm
sudo rpm -ivh postgresql13-13.16-2PGDG.rhel9.x86_64.rpm

Resolution Steps

Creating an Empty ODBC Configuration File as the user Attunity:

To resolve this issue, I created an empty .odbc.ini file under the attunity user's home directory. 

[ert@localhost etc]$ sudo su attunity 
[attunity@localhost etc]$ nano ~/.odbc.ini 
[attunity@localhost etc]$ ls ~/.odbc.ini ls: cannot access '/home/attunity/.odbc.ini': No such file or directory 
[attunity@localhost etc]$ touch ~/.odbc.ini
odbcinst -j 

After creating the .odbc.ini file, resulting odbcinst -j :

[attunity@@localhos etc]$ odbcinst -j
unixODBC 2.3.9 DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/attunity/.odbc.ini
SQLULEN Size.......: 8 
SQLLEN Size........: 8 
SQLSETPOSIROW Size.: 8

By following these steps, the ODBC connection test was successful.

Contributors
Version history
Last update:
‎2024-05-03 06:08 AM
Updated by: