In case of a connection problem, the dbExpress driver throws a TDBXError but does not include a socket error code. The message is simply:

Unable to complete network request to host “exampledb.local”. Failed to establish a connection

Is there a way to retrieve the underlying socket error when this type of exception occurs?

The stack trace is:

main thread ($5934):
0061aa59 +051 example.exe DBXCommon    447  +0 TDBXContext.Error
00817f14 +10c example.exe DBXDynalink  796 +21 TDBXMethodTable.RaiseError
00818553 +013 example.exe DBXDynalink  949  +1 TDBXDynalinkConnection.CheckResult
00818744 +050 example.exe DBXDynalink 1048  +4 TDBXDynalinkConnection.DerivedOpen
0061750f +007 example.exe DBXCommon    447  +0 TDBXConnection.Open
00612fed +0f5 example.exe DBXCommon    447  +0 TDBXConnectionFactory.GetConnection
00612ef1 +005 example.exe DBXCommon    447  +0 TDBXConnectionFactory.GetConnection
0062c08f +26f example.exe SqlExpr              TSQLConnection.DoConnect
005d9019 +039 example.exe DB                   TCustomConnection.SetConnected
005d8fd4 +004 example.exe DB                   TCustomConnection.Open
0062b98f +01b example.exe SqlExpr              TSQLConnection.CheckConnection
0062ebdf +01f example.exe SqlExpr              TCustomSQLDataSet.CheckConnection
0062efe4 +04c example.exe SqlExpr              TCustomSQLDataSet.OpenCursor
005e91d5 +055 example.exe DB                   TDataSet.SetActive
005e901c +004 example.exe DB                   TDataSet.Open

src :