From: Oliver on
Newbie, looking at DB2 on AS400 iSeries, on Windows network. I have
read that users are authenticated at the OS level, not at the database
level.

How do I make it possible for users to change their passwords on their
own? I have been trying to use the CONNECT command, but I'm getting
nowhere. When I run the following command:

CONNECT TO dbname USER username USING 'pwd'

that resolves, but when I try this:

CONNECT TO dbname USER username USING 'pwd' NEW 'newpwd' CONFIRM
'newpwd'

then I get an error message saying that NEW was not expected. What
would cause that?

Is there any way to test this command directly within the Run SQL
Script tool? I see it's to be used when first connecting .. just
wondering.

My goal here is to have a webpage or small GUI that the users can
access, type in their old and new passwords, press a button, and
expect that the password will be modified. Surely this isn't rocket
science .. it's almost trivial in MS SQL Server .. so I figure I'm
missing something, probably something obvious, and I ask for your
assistance.

Thank you.

From: Karl Hanson on
Oliver wrote:
> Newbie, looking at DB2 on AS400 iSeries, on Windows network. I have
> read that users are authenticated at the OS level, not at the database
> level.
>
> How do I make it possible for users to change their passwords on their
> own? I have been trying to use the CONNECT command, but I'm getting
> nowhere. When I run the following command:
>
> CONNECT TO dbname USER username USING 'pwd'
>
> that resolves, but when I try this:
>
> CONNECT TO dbname USER username USING 'pwd' NEW 'newpwd' CONFIRM
> 'newpwd'
>
> then I get an error message saying that NEW was not expected. What
> would cause that?
>
> Is there any way to test this command directly within the Run SQL
> Script tool? I see it's to be used when first connecting .. just
> wondering.
>
> My goal here is to have a webpage or small GUI that the users can
> access, type in their old and new passwords, press a button, and
> expect that the password will be modified. Surely this isn't rocket
> science .. it's almost trivial in MS SQL Server .. so I figure I'm
> missing something, probably something obvious, and I ask for your
> assistance.
>

As you've discovered, NEW and CONFIRM are not supported clauses:
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/db2/rbafzmstconj1.htm

Since authentication is part of the OS, one thought (if you must do this
via an SQL interface) would be to create a stored procedure that calls
the Change User Password API:
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/apis/QSYCHGPW.htm

--
Karl Hanson