DB2 Version 10.1 for Linux, UNIX, and Windows

sqleAttachToCtx API - Attach to context

Start of change Makes the current thread use a specified context. All subsequent database calls made on this thread will use this context.End of change

Scope

The scope of this API is limited to the immediate process.

Authorization

None

Required connection

None

API include file

sql.h

API and data structure syntax

SQL_API_RC SQL_API_FN
  sqleAttachToCtx (
        void * pCtx,
        void * reserved,
        struct sqlca * pSqlca);

sqleAttachToCtx API parameters

pCtx
Input. A valid context previously allocated by sqleBeginCtx.
reserved
Reserved for future use. Must be set to NULL.
pSqlca
Output. A pointer to the sqlca structure.
Start of change

Usage notes

If more than one thread is attached to a given context, only one of the attached threads can issue SQL at a given time, since they share the same connection and unit of work. In this case, when one thread is executing SQL, the other threads will wait for that SQL to complete before they are allowed to execute SQL.

End of change