TOraSession.ChangePassword doesn't work (5.55.1.24)

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
stefanmeisner
Posts: 6
Joined: Thu 24 Nov 2005 17:39
Location: Vienna, Austria

TOraSession.ChangePassword doesn't work (5.55.1.24)

Post by stefanmeisner » Mon 19 Dec 2005 13:30

Doesn't work if session is not connected.
However, this should be easy to fix:


//----------------------------------------------------------------------------
//2005-12-19 14:05 N,??:
//2005-12-19 14:05 B,SM B3587: try/finally used (to return connection)
// using SetUserName/SetPassword if not connected

procedure TOraSession.ChangePassword(NewPassword: string);
begin
CreateIConnection;
try //B3587
//B3587 begin
if not Connected then
begin
FIConnection.SetUsername(Username);
FIConnection.SetPassword(Password);
end;
//B3587 end
FIConnection.ChangePassword(NewPassword);
FPassword := NewPassword;
FIConnection.SetPassword(PChar(FPassword));
finally //B3587
if not Connected and (FIConnection.Pool nil) then begin
ConnectionPoolManager.ReturnConnection(FIConnection);
SetIConnection(nil);
end;
end;
end;


Regards
Stefan Meisner

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Tue 20 Dec 2005 09:58

Odac needs Connect method to be called before ChangePassord is called to set
all necessary internal connection settings. If you are Pro-version user you can
change ChangePassord procedure as you want but we will not support these changes.

stefanmeisner
Posts: 6
Joined: Thu 24 Nov 2005 17:39
Location: Vienna, Austria

ChangePassword

Post by stefanmeisner » Tue 20 Dec 2005 10:01

Suppose, the user can't connect due to an expired password he won't be able to connect and thus be unable to change his/her password.
This has been the reason to apply this fix.
Greetings
Stefan Meisner

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Wed 21 Dec 2005 08:19

When user tries to connect with expired password TOraSession raises
an exception. But it would be enough to call ChangePassword procedure. So you can use try...except block or OnError event handler to catch this exception and if needed call ChangePassword.

Post Reply