We have a huge system which use DOS batch and VBScript to access to IBM DB2. In the system, we use ADODB.Command.CommandTimeout property.
Our client request that they want to know whether it is because of timeout or not when they have an error in the batch process. We assumed that there must be an error code(Err.Number) for timeout, researched log files of timeout error and found that there are at least two pattern of error code.
Pattern 1: Err.number = 3712
Pattern 2: Err.number = -2147467259
Not sure is there any other patterns of timeout error code. It seems that system simply cancels the connection when it hits time limit and returns error caused by the canceling, not caused by timeout itself. When we have an error in the batch process, we would like to detect whether it is caused by timeout or not. Is there any way to detect?
(Edit)Here's a code where we execute SQL and handle errors
'timeout setting
oAdoCommand.CommandTimeout = ENV_DB_TIMEOUT
On Error Resume Next
'Execute
Set oRs = oAdoCommand.Execute
If Err.Number <> 0 Then
'Error handling (We'd like to detect timeout around here)
Call FN05MakeWriteLogMsg("FN01E0103", "E", MSG_FN01E0103, Empty, 1, sLogMsg) 'Function to edit and log error message
Set oRs = Nothing
Set oAdoCommand = Nothing
Exit Function
End If
On Error Goto 0
Regards,