ODBC API return codes

Every IBM® i Access ODBC API function returns a value of type SQLRETURN (a short integer). There are seven possible return codes, and associated with each is a manifest constant.

The following list provides an explanation of each particular code. Some return codes can be interpreted as an error on the function call. Others indicate success. Still others indicate that more information is needed or pending.

A particular function may not return all possible codes. See the Microsoft ODBC 3.0 Software Development Kit and Programmer's Reference, Version 3.0 ISBN 1-57231-516-4. for possible values, and for the precise interpretation for that function.

Pay close attention to return codes in your program, particularly those that are associated with the processing of SQL statements processing and with data source data access. In many instances the return code is the only reliable way of determining the success of a function.

SQL_SUCCESS
Function has completed successfully; no additional information available.
SQL_SUCCESS_WITH_INFO
Function completed successfully; possibly with a nonfatal error. The application can call SQLGetDiagRec to retrieve additional information.
SQL_NO_DATA_FOUND
All rows from the result set have been fetched.
SQL_ERROR
Function failed. The application can call SQLGetDiagRec to retrieve error information.
SQL_INVALID_HANDLE
Function failed due to an unusable environment, connection, or statement handle. Programming error.
SQL_NEED_DATA
The driver is asking the application to send parameter data values.