Your application (on the client) would link to a Unix ODBC library -- either iODBC or unixodbc. Both are commonly available on Debian and Ubuntu and other distros.
Next, you install the ODBC driver from the server database. This means you need to get a DB2 ODBC driver onto your system.
With that, your application is capable of 'talking ODBC' and has someone to talk to: the ODBC driver of DB2.
To give another concrete example, I compile RODBC again unixodbc-dev for Debian and can then talk via ODBC to MySQL and Postgresql as I have drivers for both. [ This is of course contrived as both MySQL and Postgresql have native drivers too, but it servers as a test of RODBC. ]