db2commexitInit API - Initialization

When the database manager is started with the db2start command, the communication buffer exit library is loaded. Immediately following the load of the library, this function is called. This function is responsible for initializing the communication buffer exit library. The function is also responsible for returning all of the implemented functions back to the database manager. It can be called by both types of communication exit libraries.

This function must be declared extern "C" if the library is compiled as C++.

This function is not required to be threadsafe, since it is only called a single time.

API header file

db2commexit.h

API and data structure syntax

SQL_API_RC ( SQL_API_FN * db2commexitInit )
(
      db2int32 version,
      void *commexit_fns,
      db2commexitLogMessage *logMessage_fn,
      char     **errormsg,
      db2int32 *errormsglen
);

db2commexiInit API Parameters

version
Input. The highest version of the API supported by the instance loading that library. The value DB2COMMEXIT_API_VERSION, in db2commexit.h, contains the latest version number of the API that the database manager currently supports. If the library implements a communication buffer exit library, then db2commexitInit function must call the DB2COMMEXIT_GET_BUFFER_FN_VER macro to get the highest version of the API supported. If the library implements a runtime communication exit library, then db2commexitInit function must call the DB2COMMEXIT_GET_RUNTIME_FN_VER macro to get the highest version of the API supported.
commexit_fns
Output. A pointer to the db2commexitFunctions_<version_number> structure, that contains pointers to the APIs implemented for the communication buffer exit library. There might be different versions of the APIs, so the commexit_fns parameter is cast to the db2commexitFunctions_<version_number> structure corresponding to the version implemented by the library. The first parameter of the db2commexitFunctions_<version_number> structure indicates the version of the APIs implemented by the plug-in. If the library implements a communication buffer exit library, the version number must by set by calling the DB2COMMEXIT_SET_BUFFER_FN_VER macro. If the library implements a runtime communication exit library, the version number must be set by calling the DB2COMMEXIT_SET_RUNTIME_FN_VER macro. Another member, nonSQLAPIVersion, of the structure tells the database manager which version number of the non-SQL APIs that the library can handle. Currently, only DB2COMMEXIT_NONSQL_API_VERSION_KEPLER is supported.
logMessage_fn
Input. A pointer to the db2commexitLogMessage API, which is implemented by the database manager. The db2commexitInit API can call the db2commexitLogMessage API to log messages to the db2diag log files for debugging or informational purposes. The first parameter of the db2commexitLogMessage API specifies the type of diagnostic errors that are recorded in the db2diag log files and the last two parameters are the message string and its length. The valid values for the first parameter of the db2commexitLogMessage API, defined in db2commexit.h, are:
  • DB2COMMEXIT_LOG_NONE: (0) No logging
  • DB2COMMEXIT_LOG_CRITICAL: (1) Severe Error encountered
  • DB2COMMEXIT_LOG_ERROR: (2) Error encountered
  • DB2COMMEXIT_LOG_WARNING: (3) Warning
  • DB2COMMEXIT_LOG_INFO: (4) Informational
The message text is logged in the db2diag log files only if the value of the 'level' parameter of the db2commexitLogMessage API is less than or equal to the diaglevel database manager configuration parameter. For example, if you use the DB2COMMEXIT_LOG_INFO value, the message text is logged only if the diaglevel database manager configuration parameter is set to 4.
errormsg
Output. A pointer to the address of an ASCII error message string. This pointer is allocated by the plug-in and can be returned in this parameter if the function execution is not successful. This memory is freed by calling db2commexitFreeErrormsg.
errormsglen
Output. A pointer to an integer that indicates the length, in bytes, of the error message string in the errormsg parameter.