Connection parameters

To indicate which database server the client LIBMI application needs to connect to, the application uses connection parameters. The DataBlade® API provides a connection-information descriptor, MI_CONNECTION_INFO, to access connection parameters.

The MI_CONNECTION_INFO data type structure is similar in concept to a file descriptor in UNIX™. It identifies the database server for a particular session.

Unlike most DataBlade API structures, the connection-information descriptor is not an opaque C data structure. To access connection parameters, you must allocate a connection-information descriptor and directly access its fields. The following table shows the fields in the connection-information descriptor.
Table 1. Fields in the connection-information descriptor
Field Data type Description
server_name char * The name of the default database server

This field corresponds to the value of the INFORMIXSERVER environment variable.

server_port mi_integer This value is ignored. It must always be set to zero.

A client LIBMI application does not need to specify the server port. It only needs to specify a database server by its name (the server_name field).

locale char * In a C UDR: The name of the server locale

This field corresponds to the SERVER_LOCALE environment variable (as set on the computer with the database server).

In a client LIBMI application: the name of the database locale

This field corresponds to the DB_LOCALE environment variable (as set on the computer with the client LIBMI application).

reserved1 mi_integer Unused
reserved2 mi_integer Unused

The milib.h header file defines the MI_CONNECTION_INFO structure.

With the connection-information descriptor, you can use the following DataBlade API functions to perform the connection-parameter tasks.
Connection-parameter task DataBlade API function
Access the default connection parameters to determine the database server for the connection mi_set_default_connection_info(), mi_get_default_connection_info()
Obtain current connection parameters for an open connection mi_get_connection_info()