ODBC Adapter Synchronous and Asynchronous Operation

[This is preliminary documentation and subject to change.]

By default, the adapter operates in synchronous mode. That is, the adapter does not return control to a client application until the function call completes.

However, the adapter also supports asynchronous operation. In ODBC, asynchronous processing is performed on a statement-by-statement basis.

    To have a client application execute a statement asynchronously
  1. Call SQLSetStmtOption with the SQL_ASYNC_ENABLE option.
  2. Call the ODBC function. The adapter begins asynchronous operation and returns SQL_SQL_STILL_EXECUTING.
  3. Perform other operations and call other ODBC functions on different statement handles while the adapter is working.
  4. Optionally, the application can call the original function on the original statement handle to determine if the function has completed. If it has completed, the function returns with SQL_SUCCESS or SQL_SUCCESS_WITH_INFO. Otherwise, it returns with SQL_STILL_EXECUTING.

Note  The ODBC adapter is a Common Information Model (CIM) client. Therefore, it has limited control over the duration of synchronous CIM calls, and this duration can be substantial. Applications may have to spawn a thread to implement ODBC functionality. This is especially true for all ODBC client applications designated for use with diverse ODBC data sources.

See Also

ODBC Handles