OCI_INVALID_HANDLE TOraSession.ChangePassword

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
AdamKG
Posts: 18
Joined: Fri 13 Nov 2009 10:32

OCI_INVALID_HANDLE TOraSession.ChangePassword

Post by AdamKG » Mon 19 Apr 2010 21:38

Hello,

I try to provide in my application possibility to change password if user is in grace period. But geting OCI_INVALID_HANDLE

Steps to reproduce:
drop TOraSession on form set ConnectString to user with grace period and OnInfoMessage event to

Code: Select all

procedure TForm1.OraSession1InfoMessage(Sender: TObject; Error: EOraError);
begin
  if Error.ErrorCode=28002 then
    OraSession1.ChangePassword('test');
end;
When orasession1.connect is done on user who has grace period the password is changed but an error is rised as well.

ODAC 6.90.0.57 for RAD Studio 2007

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Tue 20 Apr 2010 11:09

Hello

Unfortunately we cannot reproduce your issue. Please tell us the version of Oracle client and server you are using.

AdamKG
Posts: 18
Joined: Fri 13 Nov 2009 10:32

Post by AdamKG » Tue 20 Apr 2010 11:19

OCI: Version 11.1.0.1.0 (not loaded)
DLL: c:\oracle_x32\product\11.1.0\client_1\BIN\oci.dll

Oracle Database 11g Release 11.1.0.6.0 - 64bit Production

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Wed 21 Apr 2010 12:13

Hello

The problem is that when you are handling the OnInfoMessage event, connection is not fully established and a part of OCI variables is initialized and another part is not initialized. If you are trying to change password at this moment then you will get the OCI_INVALID_HANDLE error.

You should set a variable in the OnInfoMessage event:

procedure TForm1.OraSession1InfoMessage(Sender: TObject; Error: EOraError);
begin
if Error.ErrorCode=28002 then
FPasswordExpired := true;
end;

And change password in the OnAfterConnect event when connection is established:

procedure TForm1.OraSession1AfterConnect(Sender: TObject);
begin
if FPasswordExpired then
OraSession1.ChangePassword('new_password');
end;

Post Reply