To close a connection, free the associated connection descriptor. When the connection descriptor is freed, the DataBlade API also frees the session-context resources, including the following:
To conserve resources, use mi_close( ) to deallocate the connection descriptor explicitly once your DataBlade API module no longer needs it. The mi_close( ) function is the destructor function for a connection descriptor. It frees the connection descriptor and any resources that are associated with it.
In a C UDR, a public connection descriptor has a memory duration of PER_STMT_EXEC. Therefore, a connection descriptor remains active until one of the following events occurs:
When a UDR connection is closed, the UDR can no longer access the associated connection information (see Table 44). However, the session remains open until the client application ends it. Therefore, a UDR can obtain a new UDR connection with another call to mi_open( ).
A session-duration connection descriptor has a memory duration of PER_SESSION. Therefore, it and its associated connection information remain valid until the end of the session. However, a session-duration connection is a restricted feature of the DataBlade API. Use it only when a public connection descriptor will not perform the task you need. For more information, see Obtaining a Session-Duration Connection Descriptor.
In a client LIBMI application, a connection descriptor has a scope of the session. When the client connection closes, the session ends. Therefore, a connection descriptor remains active until one of the following events occurs: