Return the encrypted password used to log on to a database path.
Path—DBMS path name, without the leading dollar sign ($).
- Encrypted password used to log on to Path, if the DBMS or operating system support returning the encrypted password.
Path is omitted:
- For Windows, $password returns the value of password in [user] section in the usys.ini.
- For other operating systems, it returns the value of the environment variable
- Empty string (""), if the password INI setting or
PASSWORDenvironment variable is empty.
Allowed in all Uniface component types.
The $password function is supported only for DBMSs which require a user name to log in. It is not supported for network drivers.
However, if a database path name is assigned to a network path, the network driver is requested to open the path. The network path may also be re-assigned to another server. As long as a server in the chain assigns the path name to a database driver, this is supported.
$user and $password are often used to construct the logon string given to the Proc open statement. For example, if you want to close and then open a database, you can use $user and $password to get these values before closing. Then use these values to open the database. This avoids re-prompting the user for information they may have already entered.
The returned password is encrypted for security. Uniface transparently handles encryption and decryption when passing and returning the password to and from the database.
The following example saves the password and user name used to open a particular path, closes the path, then opens the path again:
$1 = $password(CUSTOMERS) $2 = $user(CUSTOMERS) close "$CUSTOMERS" open "|%%$2|%%$1","$CUSTOMERS"
|9.7.05.029||Returned password is encrypted.
Important: This change in the behavior $password can cause compatibility issues in existing Proc that is expecting unencrypted passwords.