To indicate which database it needs to connect to, the client LIBMI application uses database parameters. The DataBlade API provides a database-information descriptor, MI_DATABASE_INFO, to access database parameters. This data type structure identifies the database for a particular session.
Unlike most DataBlade API structures, the database-information descriptor is not an opaque C data structure. To access database information, you must allocate a database-information descriptor and directly access its fields. Table 47 shows the fields in the database-information descriptor.
The milib.h header file defines the MI_DATABASE_INFO structure.
With the database-information descriptor, you can use the following DataBlade API functions to perform the database-parameter tasks.
The default database parameters identify the database and user for the connection. Before you establish a connection, you can determine which of the following database parameters to use:
The database server obtains values for the system-default database parameters from the execution environment of the client LIBMI application. When you use system-default database parameters, you enable your application to be portable across client/server environments. However, you must ensure that the client/server environment is correctly initialized to provide the system-default values.
Table 48 shows the system-default database parameters that the database server uses to open a database.
The system-default database parameters provide database information for all connections made within a client LIBMI application unless you explicitly override them within the application.
The database server obtains values for the database parameters from the database-information descriptor. The database server initializes the database-information descriptor with the system-default database parameters in Table 48. You can initialize your own database-information descriptor to override the default database parameters. When you override system-default database parameters, you enable your application to have database information that is independent of the client/server environment in which it runs.
If you do not set a particular field, the database server uses the system-default value in Table 48 for the associated database parameter.
The user-defined database parameters provide database 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 database parameters with the mi_get_default_database_info( ) function. This function populates a user-defined database-information descriptor with the current default database parameters.
In a C UDR, mi_get_default_database_info( ) obtains the same information as mi_get_database_info( ). The mi_set_default_database_info( ) function is ignored.
To obtain database parameters associated with an open connection, use the mi_get_database_info( ) function. This function populates a user-defined database-information descriptor with values from the specified open connection.
The mi_get_database_info( ) function is valid with a C UDR.