The mi_get_connection_info() function

The mi_get_connection_info() function populates a connection-information descriptor with current connection parameters for an open connection.

Syntax

mi_integer mi_get_connection_info(conn, conn_info)
   MI_CONNECTION *conn;
   MI_CONNECTION_INFO *conn_info;
conn
A pointer to a connection descriptor established by a previous call to mi_open(), mi_server_connect(), or mi_server_reconnect().
conn_info
A pointer to a user-provided connection-information descriptor, to store the current connection parameters.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_get_connection_info() function puts the current connection parameters for the connection that conn references into the descriptor (MI_CONNECTION_INFO structure) that conn_info references. The connection parameters in this structure include the name of the database server, the number of the server port, and a GLS locale:
typedef struct mi_connection_info
    {
    char   *server_name; /* ONEDB_SERVER */
    mi_integer server_port;  /* SERVERNUM */
    char   *locale;      /* Processing locale */
    mi_integer reserved1;    /* unused */
    mi_integer reserved2;    /* unused */
    } MI_CONNECTION_INFO;
Tip: You must allocate this connection-information descriptor before you call mi_get_connection_info().

You can pass the connection-information descriptor to mi_server_connect() to specify the connection parameters for a connection from the client LIBMI application to the database server.

The mi_get_connection_info() function initializes the DataBlade® API when it is the first DataBlade API function in a client LIBMI application or a C user-defined routine.

The GLS locale in the connection parameters refers to the server locale in a C UDR or to the database locale in a client LIBMI application. For more information about GLS locales, see the HCL OneDB™ GLS User's Guide.

For a description of the connection-information descriptor, more information about how to examine the connection-information descriptor, or more information about ways to interact with the session environment, see the HCL OneDB DataBlade API Programmer's Guide.

Return values

MI_OK
The function was successful.
MI_ERROR
The function was not successful.