If Db2 is already installed (for use as staging or control database) then the software is already present.
Add this stanza to /etc/odbcinst.ini
[IBM DB2 ODBC DRIVER]
Driver=/opt/ibm/db2/V11.5/lib64/libdb2o.so
dontdlclose=1
[IBM DB2 ODBC DRIVER - DB2COPY1]
Driver=/opt/ibm/db2/V11.5/lib64/libdb2o.so
dontdlclose=1
a typical DSN looks like
[MYDB]
Driver=IBM DB2 ODBC DRIVER
where MYDB has been cataloged as a remote database:
db2 catalog tcpip node myhost remote myhost server 446
db2 catalog database MYDB as MYDB at node myhost authentication SERVER
(or authentication SERVER_ENCRYPT if the Db2 LUW is configured as SERVER_ENCRYPT)
or a DSN specifying the connection information:
[MYDB]
Driver=IBM DB2 ODBC DRIVER
Hostname=myhost
port=50000
Database=MYDB
Authentication=SERVER
* setting environment variables
. ~db2inst1/sqllib/db2profile
or at minimum
export DB2INSTANCE=db2inst1
Using SSL requires configuring GSKit and DB2 UPDATE DBM. See
SQDR Plus: Configuring Db2 LUW for SSL
This was written for Windows but the GSkit and DB2 UPDATE DBM commands are similar on Linux.
References:
IBM Db2 11.5 documentation: Setting up the ODBC environment (Linux and UNIX)