13.12 Implementing Modify Password with Embedded SQL

Modifying a password is usually accomplished by altering an existing database user account. Assuming that a <modify-password> event is generated on the Subscriber channel, the following is an example of the output generated by XSLT style sheets that implement modify-password:

NOTE:Some databases, such as Sybase Adaptive Server Enterprise and Microsoft SQL Server, differentiate between user account names and login account names. Therefore, you might need to supply the login name instead of hte user name.

<input xmlns:jdbc="urn:dirxml:jdbc">
    <modify-password jdbc:op-id="0" 
                     jdbc:op-type="password-set-operation">
       <password>new password</password>
    </modify-password>
    <jdbc:statement jdbc:op-id="0">
        <jdbc:sql>ALTER USER jdoe IDENTIFIED BY {$$password}
        </jdbc:sql>
    </jdbc:statement>
</input>

The <modify-password> event is logically bound to the ALTER USER DDL statement by the jdbc:op-id and jdbc:op-type attributes.

The User DDL Command Transformation style sheet in the example .xml configuration contains sample XSLT templates that bind password maintenance DDL statements to <modify-password> events for all databases that support them.