SybasePhone Number

 
Modifying an Oracle user's password from PowerBuilder

Oracle User's password modification using PL/SQL:

Oracle provides a PL/SQL command called alter user which allows you to change the password of an Oracle user (login id). The following is the syntax for the alter user command:

alter user <username> identified by <new_password>

Note: You must specify <username> even if you are changing your own password. You cannot change another user's password without the alter user privilege.

Security note: Oracle8 has new password security features. For example, you can set a minimum password length. The default behavior of Oracle8 is consistent with previous versions of Oracle - no minimum password length. If your company uses these new features then you may want to include guidelines for choosing a new password in your change password dialog box.

The following example illustrates how to change the password of the user "joeuser" from its current value to "abc132" using an Oracle DBA tool such as SQL*Plus or SQL*Worksheet:

alter user joeuser identified by abc123;

Oracle User's password modification from within a PowerBuilder Application:

It is possible to change an Oracle password from within a PowerBuilder application. In this example, a window contains two (2) singleline edit controls and a command button:

sle_name this is where the user enters the username (logon id)
sle_pass this is where the user enters the new password
cb_ok the user clicks this control to execute the password change

The user enters the Oracle username (logon ID) whose password is to be changed and the new password. Once this information is gathered it needs to be passed to Oracle via EXECUTE IMMEDIATE. This code works on all supported versions of PowerBuilder using Oracle 7.3, 8.0 and 8i2.

The code in the clicked event of the command button (cb_ok) contains at least the following and may also contain connect/disconnect information:

string mysql, username, password
username = sle_name.text
password = sle_pass.text
mysql = "ALTER USER " + username + " IDENTIFIED BY " + password
EXECUTE IMMEDIATE :mysql USING SQLCA;
IF SQLCA.SQLCode = -1 THEN
MessageBox("SQL error " + String(SQCA.SQLDBCode), SQLCA.ErrText)
END IF

If the user will be changing only his/her own username, consider using only one singleline edit (sle_pass) and obtaining the username from the LogId property of the transaction object.

© Copyright 2014, Sybase Inc. - v 7.6