How to Use ESQL in a Threaded Application (151598)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)
  • Microsoft SQL Server 6.5
  • Microsoft Embedded SQL for C Programmer's Toolkit 4.22

This article was previously published under Q151598

SUMMARY

This article describes how you use ESQL in a threaded application.

MORE INFORMATION

Embedded SQL Server for C is not thread-safe. If you use ESQL in a threaded application, you must only use ESQL calls from a single thread of execution, and it is best if you use the main thread.

If you put the ESQL calls in a thread other than the main thread, the thread can only be started one time. The thread must then remain available for all subsequent ESQL needs. To clarify, if you put the ESQL calls in a thread, and you then start and stop that thread multiple times to perform database tasks, you may experience unexpected behavior.

To implement a thread that handles all ESQL activity, you must set up the thread with an event-triggering mechanism.

This applies to Embedded SQL versions 4.22, 6.5 and 2000.


Modification Type:MajorLast Reviewed:6/10/2003
Keywords:kbinfo kbProgramming KB151598 kbAudDeveloper