HOW TO: Using DB-LIBRARY in a Threaded Application (151607)



The information in this article applies to:

  • Microsoft SQL Server 6.0
  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q151607

SUMMARY

This article provides tips for using DB-LIBRARY in a threaded application.

back to the top

Tips for Using DB-LIBRARY in a Threaded Application

When you are creating a DB-LIBRARY threaded application:
  • Only call the dbinit and dbexit functions one time on your application.
  • Use per-process error and message handling. For additional information, see dbprocerrhandle and dbprocmsghandle.

    If you use global error and message handlers, you may have to synchronize access in your error and message handler routines.
  • Call dbsetmaxprocs if you are going to have more than 25 connections open simultaneously.
  • Make sure to perform compiling and linking by using the multi-threaded C or C++ run-time libraries. By default, a Microsoft Visual C or a Microsoft Visual C++ project is linked with the single-threaded run-time libraries.
  • If you use the same LOGINREC to open multiple connections, you must serialize access to LOGINREC.
Note The DB-LIBRARY programming model is not supported in SQL Server 2000 64 bit, and it has not been ported to the 64-bit version of Microsoft Windows. back to the top

Modification Type:MinorLast Reviewed:2/14/2005
Keywords:kbhowto kbHOWTOmaster KB151607 kbAudDeveloper