The mi_set_default_connection_info() function

The mi_set_default_connection_info() function sets the default connection parameters with values from a connection-information descriptor that the user provides.

Syntax

mi_integer mi_set_default_connection_info(conn_info)
   MI_CONNECTION_INFO *conn_info;
conn_info
A pointer to a user-provided connection-information descriptor, which sets the default connection parameters.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Ignored

Usage

Client only: The mi_set_default_connection_info() function sets default connection parameters from the user-defined values in the connection-information descriptor (MI_CONNECTION_INFO structure) that conn_info references. The connection parameters include the name of the database server and a GLS locale.

You must allocate this connection-information descriptor before you call mi_set_default_connection_info().

After this function sets the default connection parameters, you can pass the conn_info descriptor to mi_server_connect() to specify the default connection parameters for a connection.

If you do not want to change a particular default value, initialize string fields to a NULL-valued pointer and integer fields to zero. To use the default database server, initialize the server_name field of the connection-information descriptor to a NULL-valued pointer. To specify a new default database server, specify a null-terminated string for the server_name field.

This function returns MI_ERROR if mi_sysname() failed when it attempted to set the database server name. If the client LIBMI application has not registered a callback function to handle the MI_LIB_BADSERV error, it must check the return status of mi_set_default_connection_info().

In a client LIBMI application, the GLS locale in the default connection parameters refers to the database locale. For more information about GLS locales, see the Informix® GLS User's Guide.

When mi_set_default_connection_info() is the first DataBlade® API function in a client LIBMI application or a user-defined routine, it initializes the DataBlade® API.

You can obtain the current values of the default connection parameters with the mi_get_default_connection_info() function.

Server only: The mi_set_default_connection_info() function is ignored when it is used as a user-defined routine.

For a description of the connection-information descriptor or more information about how to use the connection-information descriptor, see the Informix® DataBlade® API Programmer's Guide.

Return values

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