$password

Return the encrypted password used to log on to a database path.

$password { (Path) }

Example: vPw=$password(DBMS)

Parameters

Parameters
Parameter Data Type Description
Path Literal Path name, without the leading dollar sign ($).

Return Values

  • Encrypted password used to log on to Path (if the DBMS or operating system support returning the password).
  • If Path is omitted:
    • For Windows, $password returns the value of password in the [user] section of the usys.ini.
    • For other operating systems, it returns the value of the environment variable password.
  • Empty string (""), if the password setting or PASSWORD environment variable is empty.

Use

Allowed in all component types.

Description

The $password function is supported for databases that 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 ProcScript 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.

Using $password

The following example saves the password and user name used to open a particular path, closes the path, then opens the path again:

vPw = $password(CUSTOMERS)
vUser = $user(CUSTOMERS)
close "$CUSTOMERS"
open "|%%vUser |%%vPw ","$CUSTOMERS"
History
Version Change
9.7.05.029 Returned password is encrypted.

Important: This change in the behavior $password can cause compatibility issues in existing ProcScript that is expecting unencrypted passwords.

Related Topics