KI_SESSIONS

Create a pseudo table of sessions in a database

Synopsis:
CALL KI_SESSIONS handle, [nConnectId] TO status
status = 'ki_sessions( handle, [nConnectId] )
ArgumentEnumerationPurpose
handleHandle
nConnectIdConnectId of required session
statusKDB_ERROR_ENUMReturn status
>KI_SESSIONS

KI_SESSIONS

This function generates a result set containing rows from the Oracle SYS.K$SESSIONS view which contains details of all the connected Oracle sessions. For Oracle this is a dynamic view of the SYS.GV$SESSION table that is maintained by the database. If the database is distributed across a RAC cluster then the all the sessions on all nodes are included.

On other SQL databases it is a real table that KCML maintains. Entries are inserted by KI_CONNECT and removed by KI_DISCONNECT so there is the possibility of stale entries being left behind if a process dies abnormally.

This function is not supported on native KDB7 databases.

The handle must have been allocated with a KI_ALLOC_HANDLE and it can be used in subsequent KI_FETCH calls to get the information. When finished with the virtual table a KI_END will free resources.

The row buffer passed for the fetch operation should be an instance of the _KDB_SESSIONS record. If the optional connection identifier ConnectId is non-zero then only the row matching that ConnectId will be returned in the result set. The connection identifier for your process can be found from the INFO_CONN_ConnectId field returned by KI_INFO. You can use -1 as a shortcut for your connection id.

KI_LOCK_OWNER returns the connection id of the process that blocked a failed attempt to lock a row and you can use that id in KI_SESSIONS to get more information about that process.

Compatibility note:

KI_SESSIONS is only available for SQL databases

History
Introduced in KCML 6.60
See Also:
KI_BIND_COL, KI_BIND_PARAM, KI_BOUND_COL, KI_BOUND_PARAM, KI_COLUMNS, KI_DATABASES, KI_DEFAULT_ROW, KI_DESCRIBE_COL, KI_ERROR, KI_ERROR_TEXT, KI_EXECUTE, KI_FETCH, KI_GET_COL_LIST, KI_GET_ERROR_TEXT, KI_PARTITIONS, KI_PREFETCH_ROWS, KI_PREPARE, KI_SET_COL_LIST, KI_SQL, KI_SQL_XML, KI_TABLES, KI_TABLESPACES
KCML database status codes