I am trying to catch the "timeout expired" error from ADO.
When a timeout occurs, ADO returns:
Number: 0x80040E31 (DB_E_ABORTLIMITREACHED in oledberr.h) SQLState: HYT00 NativeError: 0
A NativeError zero makes sense because the timeout is not a function of the database engine (i.e. SQL Server), but an internal ADO timeout mechanism.
Number (i.e. the COM result) looks useful, but the DB_E_ABORTLIMITREACHED definition in oledberr.h says:
Execution stopped because the resource limit has been reached. Results were not returned.
This error may apply to things other than “time out” (some potentially server-side), for example, for a controller that restricts:
- CPU usage
- Read / Write I / O
- network bandwidth
and stops the request.
The final useful part is SQLState , which is a database-independent error code system. Unfortunately, only the link to the SQLState error codes that I can find does not mention HYT00 .
What to do? What to do?
Note: I can not trust
0x80040E31 (DB_E_ABORTLIMITREACHED)
means "timeout expired" is more than I could trust
0x80004005 (E_UNSPECIFIED_ERROR)
means that "The transaction was locked when resources were locked by another process and selected as a victim of a deadlock."
My pseudo-question is: does anyone have documentation on what SQLState " HYT000 " means?
And my real question still remains: how can I specifically catch the ADO timeout exception thrown by ADO?
Gotta love the questions that the developer is trying to “do right”, but no one knows how to do the right thing. You also need to love how googling for DB_E_ABORTLIMITREACHED , and this question number 9, with MSDN is nowhere to be found.
Update 3
From the OLEdb ICommand.Execute link :
DB_E_ABORTLIMITREACHED
Execution canceled because the resource limit has been reached. For example, the request timeout. Results not returned.
For example, which means a non-exhaustive list.
Update three
Found. The answer is used as the answer.