Use SQLSetColAttributes() to reduce network
flow
Whenever you prepare or execute a query statement directly, Db2 ODBC retrieves information about
the SQL data type and size from the data source. If you use SQLSetColAttributes() to
provide Db2 ODBC with this information
in advance, Db2 ODBC does not
need to query the data source.
Elimination of this query can significantly reduce network flow from remote data sources if the result set that comes back contains a very large number (hundreds) of columns.
Requirement: You must provide Db2 ODBC with exact result descriptor information for all columns; otherwise, an error occurs when you fetch the data.
SQLSetColAttributes() reduces the network flow
best from queries that generate result sets with a large number of
columns, but a relatively small number of rows.