Overriding the system-default connection parameters
About this task
The database server obtains values for the connection parameters from the connection-information descriptor. The database server initializes the connection-information descriptor with the system-default connection parameters in System-default session parameters. You can initialize your own connection-information descriptor to override the system-default connection parameters. When you override system-default connection parameters, you enable your application to have connection information that is independent of the client/server environment in which it runs.
To override the system-default connection parameters:
Procedure
- Allocate a connection-information descriptor.
- Fill the fields of the connection-information descriptor
with the default connection parameters you need.
To change the database server, specify a value for server_name. Any nonzero value for the server_port field is ignored. If you do not set a particular field, the database server uses the system-default value in System-default connection parameters for the associated connection parameter.
- Pass a pointer to this connection-information descriptor to the mi_set_default_connection_info() function.
Results
The user-defined connection parameters provide connection information for all connections made within a client LIBMI application after these functions execute (unless the functions are called again to set new default values).
You can obtain existing default connection parameters with the mi_get_default_connection_info() function. This function populates a user-defined connection-information descriptor with the current default connection parameters.
In a C UDR, mi_get_default_connection_info() obtains the same information as mi_get_connection_info(). The mi_set_default_connection_info() function is ignored when it is used in a UDR.