The mi_get_session_connection() function

The mi_get_session_connection() function obtains a session-duration connection descriptor.

Syntax

MI_CONNECTION *mi_get_session_connection()
Valid in client LIBMI application? Valid in user-defined routine?
No Yes
Important: This advanced function can adversely affect your UDR if you use the function incorrectly. Use it only when no regular DataBlade® API function can perform the task you need done.

Usage

The mi_get_session_connection() function obtains a session-duration connection, which provides access to the connection for the session (which the client application begins). A UDR connection that mi_open() establishes is private to the UDR; that is, it is valid until the UDR completes. A session-duration connection is valid until the end of the session.

This function is a constructor function for a session-duration connection descriptor, although it does not actually allocate a new connection descriptor. Instead, it obtains a copy of the session context for the client application and stores it in PER_SESSION memory.
Tip: You can use the session-duration connection descriptor to obtain session-duration function descriptors. For more information, see the HCL OneDB™ DataBlade API Programmer's Guide.
The following restrictions apply to the use of mi_get_session_connection():
  • Do not use mi_close() to free a session-duration connection descriptor.

    A session-duration connection descriptor has the duration of the session. An attempt to free a session-duration connection with mi_close() generates an error.

  • Do not cache a session-duration connection descriptor in the user state of an MI_FPARAM structure.

    You must obtain a session-duration connection descriptor in each UDR that uses it.

  • Do not call mi_get_session_connection() in a parallelizable UDR.

    If the UDR must be parallelizable, use mi_open() to obtain a connection descriptor.

Return values

An MI_CONNECTION pointer
A pointer to the session-duration connection descriptor for the session.
NULL
The function was not successful.