DB2 Version 10.1 for Linux, UNIX, and Windows

sqleBeginCtx API - Create and attach to an application context

Creates an application context, or creates and then attaches to an application context. More than one application context can be created. Each context has its own commit scope. Different threads can attach to different contexts (see the sqleAttachToCtx API). Any database API calls made by such threads will not be serialized with one another.

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
  sqleBeginCtx (
        void ** ppCtx,
        sqlint32 lOptions,
        void * reserved,
        struct sqlca * pSqlca);

sqleBeginCtx API parameters

ppCtx
Output. A data area allocated out of private memory for the storage of context information.
lOptions
Input. Valid values are:
SQL_CTX_CREATE_ONLY
The context memory will be allocated, but there will be no attachment.
SQL_CTX_BEGIN_ALL
The context memory will be allocated, and then a call to sqleAttachToCtx will be made for the current thread. If this option is used, the ppCtx parameter can be NULL. If the thread is already attached to a context, the call will fail.
reserved
Reserved for future use. Must be set to NULL.
pSqlca
Output. A pointer to the sqlca structure.