INF: Using SQL Db-Lib Calls in Multithreaded Programming

Last reviewed: April 25, 1997
Article ID: Q66472

The information in this article applies to:
  • Microsoft SQL Server Programmer's Toolkit, version 4.2

SUMMARY

The DB-Library (DB-Lib) routines are basically non-reentrant; therefore, you are responsible for serializing the DB-Lib calls that access the named pipe connection in multithreaded applications you develop.

MORE INFORMATION

This is true when more than one thread accesses a single dbprocess; it is necessary to serialize calls to the named pipe connection in an application where more than one thread accesses a single dbprocess.

Also, if each thread accesses a different dbprocess, you are freed of serialization concerns except for operations that involve global variables. Error and message handling is maintained globally; therefore, you might want to block on a semaphore when an error or message occurs, so that you are not preempted by another thread. The dbprocess passed to the error/message handler will distinguish which thread is involved.

Timeouts are also managed globally.


Additional query words: dblib
Keywords : kbprg SSrvDB_Lib
Version : 4.2
Platform : OS/2


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 25, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.