Microsoft KB Archive/104718

From BetaArchive Wiki

INF: Net-Library Reports OS and Network Errors

Q104718



The information in this article applies to:


  • Microsoft SQL Server Programmer's Toolkit, version 4.2





SUMMARY

DB-Library version 4.20.50 and Network Library (Net-Library) version 4.20.30 and later have an enhanced run-time error reporting. If a network or operating system error is encountered during run-time, the Net-Library will pass the network or operating system error code back to the application's DB-Library error handler.



MORE INFORMATION

The network or operating system errors reported by the Net-Library will usually have the following format:


Net-Library Error <net/os error code>:
<Net-Library function> (<net/os function>).

where

<net/os error code>

is the error code returned by the <net/os function> during run-time. The meaning of this error code depends on the <net/os function> that returned this error code, and the Net-Library in use at the time the error occurred. Please examine your network or operating system documentation for complete information about this error code.

<Net-Library function>

is the Net-Library function that was in use when the run-time error occurred.

<net/os function>

is the network or operating system function that returned the error code. Please examine your network or operating system documentation for complete information.

To properly distinguish DB-Library, Net-Library, and operating system errors, a DB-Library application should have an error handler similar to the following:


   int err_handler(dbproc, severity, dberr, oserr, dberrstr, oserrstr)

   DBPROCESS   *dbproc;
   int         severity;
   int         dberr;
   int         oserr;
   char        *dberrstr;
   char        *oserrstr;
  {
         printf("DB-Library error %d: %s\n", dberr, dberrstr);

         if (severity == EXCOMM && (oserr != DBNOERR || oserrstr))
             printf(Net-Library error %d: %s\n"' oserr, oserrstr);

         if (oserr != DBNOERR)
             printf("Operating system error %d: %s\n", oserr, oserrstr);

         if ((dbproc == NULL) || (DBDEAD(dbproc))
             return(INT_CANCEL);
         else
             return(INT_CANCEL);
  } 


For a 16-bit MS-DOS or Windows DB-Library client, the operating system errors are standard MS-DOS extended error and are documented in the "Microsoft MS-DOS Programmer's Reference" (ISBN 1-55615-329-5) in Appendix C on pages 447-449, "The Programmer's PC Sourcebook" by Thom Hogan (second edition, ISBN 1-55615-321-X) on pages 3-123 and 3-124, also "Advanced MS-DOS Programming" by Ray Duncan (second edition, ISBN 1- 55615-157-8) on pages 453-455 and in "The MS-DOS Encyclopedia" (ISBN 1-55615-174-8) in Appendix C on pages 1461-1462. They are the same codes returned by Microsoft C run-time function _dosexterr(), and also MS-DOS Int 21 Function 59H.

For a 16-bit OS/2 DB-Library client, the operating system errors are standard OS/2 errors (many are in common with the MS-DOS errors) and are documented in the "Microsoft OS/2 Programmer's Reference" Volume 3 (ISBN 1-55615-222-1) in Appendix A on pages 409-413, and also in "Essential OS/2 Functions" by Ray Duncan (ISBN 1-55615-177-2) on pages 193-203.

For a 32-bit Windows NT DB-Library client, the operating system errors are standard Windows NT errors (many are in common with the MS-DOS errors) and are documented in the "Microsoft Win32 Programmer's Reference" Volume 2 (ISBN 1-55615-516-6) in Appendix A on pages 819-869. They are the same codes returned by Win32 function GetLastError().

For example, if the following error occurred while using the named pipe Net-Library on a Microsoft LAN Manager-based network:


DB-Library Error 10010:
Possible network error: Read from SQL Server failed.
Net-Library Error 53:
ConnectionRead (read()).


This means that LAN Manager error 53 occurred when the named pipe Net-Library function ConnectionRead called the network read() function. The meaning of LAN Manager error 53 can be determined by examining the LAN Manager documentation, or typing NET HELPMSG 53 at an OS/2 command prompt which returns:


SYS0053: The network path was not found.


This error means that the server that you specified does not exist or has not been started. You should verify that you specified the path name correctly. Contact your network administrator if you continue to have problems.

Additional query words: dblib

Keywords : kbprogramming
Issue type :
Technology : kbSQLServSearch kbAudDeveloper kbSQLServPTK420


Last Reviewed: March 18, 1999
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.