Here is an excerpt from my ODBC tracing on Windows. You can see that the error is being reported as 08001 instead of 08S01:
v a14-135c ENTER SQLFetch HSTMT 0x0026DBC0
v a14-135c EXIT SQLFetch with return code 100 (SQL_NO_DATA_FOUND) HSTMT 0x0026DBC0
v a14-135c ENTER SQLFreeHandle SQLSMALLINT 3 <SQL_HANDLE_STMT> SQLHANDLE 0x0026DBC0
v a14-135c EXIT SQLFreeHandle with return code 0 (SQL_SUCCESS) SQLSMALLINT 3 <SQL_HANDLE_STMT> SQLHANDLE 0x0026DBC0
v a14-135c ENTER SQLEndTran SQLSMALLINT 2 <SQL_HANDLE_DBC> SQLHANDLE 0x0026CCC8 SQLSMALLINT 0
v a14-135c EXIT SQLEndTran with return code -1 (SQL_ERROR) SQLSMALLINT 2 <SQL_HANDLE_DBC> SQLHANDLE 0x0026CCC8 SQLSMALLINT 0
DIAG [08001] server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. (101)