UDR connection (Server)

A C UDR cannot establish a connection to the database server. It must run within an existing session, which a client application begins when it establishes a client connection.

To obtain access to an existing session, a UDR establishes a UDR connection. A UDR uses the mi_open() function (with NULL-valued pointers for all arguments) to establish a UDR connection. A UDR can have one or more UDR connections to the session.

Because a C UDR cannot establish a connection, it never begins a session. Instead, it inherits the context of an existing session from the SQL statement that invokes the UDR. This SQL statement executes within a session that the client application has begun. Therefore, the UDR is already connected to a particular database server and has access to a database that has already been opened. The UDR is also inside the current transaction.

A UDR connection provides access to the session context. This session context persists across all invocations of a UDR instance because a UDR connection has the duration of an SQL command. That is, the mi_open() function and its corresponding mi_close() function do not necessarily have to be called from within the same invocation of the UDR but they do have to be called within the same instance.