IBM Support

ODBC Prompt Mode Behavior

Troubleshooting


Problem

This document clarifies how IBM i Access Client Solutions ODBC driver uses the various signon settings to determine if a user can be prompted for signon information (user ID and/or password).

Resolving The Problem

An ODBC connection request typically contains a user profile, password, and a prompt mode setting. If the connection fails for any reason, the ODBC driver either returns an error to the application or prompts the user to enter the correct information. The type of response is controlled by the prompt mode setting.

It is important to control the prompting behavior for applications that run unattended or as services (applications such as Web servers). If an application such as this prompts for signon information, the signon dialog might not be visible from the active desktop. The application appears to hang and no other application on the server will be able to connect to the IBM i.

This document discusses the two settings that control if and when the client attempts to prompt the user for signon information. These settings are the prompt mode behavior and the default user profile.

Prompt Mode Behavior:

There are two ODBC APIs commonly used to establish a connection: SQLDriverConnect and SQLConnect.

SQLDriverConnect allows the application to specify the prompt mode behavior by using the DriverCompletion parameter. Our ODBC drivers always honor those settings. The options for prompt mode behavior are:
  • SQL_DRIVER_NOPROMPT - If the connection fails for any reason an error is returned. The user is not prompted for correct or additional information.
  • SQL_DRIVER_PROMPT - The driver will always display a dialog box with the connection string settings.
  • SQL_DRIVER_COMPLETE or SQL_DRIVER_COMPLETE REQUIRED - If any information is missing or incorrect the driver will prompt the user for the information.
Unattended applications should always use the SQL_DRIVER_NOPROMPT settings. This is the default value for the current versions of ADO.

The other connection API is SQLConnect. SQLConnect does not have a DriverCompletion parameter and the expectation is either success or failure.  Any prompting behavior is undefined.  The default behavior for the IBM i Access Client Solutions ODBC drivers is to treat this API the same as prompt if needed

APAR SA91323 introduced a new connection string/data source property (SQLConnectPromptMode) that can be used to control this behavior. If this keyword has a value of 1, the SQLConnect API will follow the ODBC specification and report any connection error back to the application without prompting. This setting should be used for programs that run unattended if the program cannot or does not use the SQLDriverConnect API. If this keyword is missing or has a value of 0, then Client Access ODBC will prompt the user for signon information as needed, rather than return the error directly. The SQLConnectPromptMode property is set in the data source using the Signon dialog prompting option found by clicking the Connection options button on the General tab.

Default User and Cached Password Values:

The default user setting defined for the IBM i connection does not control prompt behavior. Prompt behavior is controlled by the ODBC connection API. The default user value influences prompt behavior by possibly providing a missing user profile and/or password value.

If the application specifies a user profile and password on the connection those values are used.

If the user profile is specified but the password is not (it is null or a zero length string), the ODBC driver attempts to use a cached password for that user. See APAR SA90525 for further details.

If neither user profile nor password is specified (both are null or zero length strings), the ODBC driver resolves the user profile according to the Connection options, Signon information settings (Client Access Version 4), or Connection options, Default user ID settings (Client Access Version 5) of the ODBC data source. A cached password for that profile must also be available.

Our ODBC driver changed the description of these options to more accurately reflect their function starting in Version 5. The following table describes these options:
 
Version 4
Version 5
0 = Use Windows user name and password, do not prompt. 0 = Use Windows user Name
1 = Use default user ID, prompt as needed. 1 = Use the user ID specified below
2 = Prompt every time. 2 = None
3 = Use Operations Navigator default system settings. 3 = Use Operations Navigator default



Examples

Note: This chart applies to the following versions: Client Access Express V4R4 SF60796 or later; Client Access Express V4R5 SF62213 or later; Client Access Express V5R1 or later; any version of iSeries Access for Windows and IBM i Access Client Solutions.
 
Connect API SQLConnectPromptMode User Password Signon value Result
SQLConnect 0 (default) none none 0 - Use Windows user Name Desktop applications will not be prompted.

Unattended applications will hang if a user is not signed on to the desktop due to a "hidden" signon prompt.
SQLDriverConnect
SQL_DRIVER_NOPROMPT
N/A none none 3- none An error is returned to the application because insufficient information was provided to establish a connection.

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000001gDAAAY","label":"Data Access-\u003EODBC"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Historical Number

17512840

Document Information

Modified date:
13 November 2024

UID

nas8N1017951