Sharing Embedded SQL/C objects among multiple threads

By default, Embedded SQL/C connections, cursors, and dynamic statements cannot be shared by multiple threads. The namespace for each of these object types is limited to the currently executing thread; one thread cannot refer to objects that were created by another thread. Objects can be shared by setting the macro CONNECTIONS_ARE_SHARED_ACROSS_THREADS to 1 by using the -D compiler option when compiling the sybesql.c module.

WARNING! If Embedded SQL/C objects are shared by multiple threads, the application programmer must add thread serialization code to ensure that objects associated with a single connection are not used simultaneously by multiple threads.

Dynamic descriptors can normally be shared by multiple threads. To give each thread its own namespace for dynamic descriptors, use the -D compiler option to set the macro DESCRIPTOR_SCOPE_IS_THREAD to 1 when compiling thesybesql.c module.