InetLogin field values

Your application must set InetLogin values before it executes the SQL statement or library function that needs the configuration information. It is recommended that you use the ifx_putenv() and ifx_getenv() functions to set and retrieve InetLogin field values through environment variables, but you can set the values of the InetLogin fields directly.

The following figure shows a dialog box that a client application might use to obtain network parameters from an end user. This application takes the account information that the user enters and sets the appropriate network values in the InetLogin structure.
Figure 1: User dialog box for login parameters


The following figure shows a code fragment that sets login values in the InetLogin structure. The application can obtain these values from the end user through a dialog box (such as the one in User dialog box for login parameters).
Figure 2: Code to prompt the user for InetLogin values
strcpy(InetLogin.InfxServer, "mainsrvr");

;

case IDOK:
   *szDlgString = '\0';
   GetDlgItemText (hdlg, IDC_HOST, szDlgString, cbSzDlgMax);
   strcpy(InetLogin.Host, szDlgString);

   *szDlgString = '\0';
   GetDlgItemText (hdlg, IDC_USER, szDlgString, cbSzDlgMax);
   strcpy(InetLogin.User, szDlgString);
In the previous figure, if the user enters host information, the fragment sets the InetLogin.Host and InetLogin.User fields for the mainsrvr database server to the user-specified names of the host name and user name. If the user does not enter host information, uses the HOST and USER Registry values from the subkey for the mainsrvr database server.
Tip: For another example of how to set the InetLogin fields, see the ILOGIN demonstration program in the %ONEDB_HOME%\demo\ilogin directory.