Limit the number of rows that an application can fetch

If a result set is too large, it might cause problems for the application. You can follow guidelines to reduce errors.

To limit the number of rows that your application can fetch, set the SQL_ATTR_MAX_ROWS attribute with SQLSetStmtAttr(). You can use this attribute to ensure that a very large result set does not overwhelm your application. This kind of protection is especially important for applications that run on clients with limited memory resources.

Important: The server generates a full result set regardless of the SQL_ATTR_MAX_ROWS attribute value. Db2 ODBC limits only the fetch to SQL_ATTR_MAX_ROWS.