Oracle Warnings to be trapped

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
mohamedsuhail
Posts: 1
Joined: Wed 05 Jan 2011 04:12
Location: Bangalore, India

Oracle Warnings to be trapped

Post by mohamedsuhail » Wed 05 Jan 2011 04:49

Oracle Warnings to be trapped
Oracle Version 8i and Oracle 9i.
Delphi5.0 using ODAC Components 3.20

We have a requirement where we need to trap the error/warnings from Oracle (Settings will be done on profile for the password expiry, password lock etc ).

We tried in the development by doing the settings in the profile, and then we had created a new user. Then tried to connect through oracle client and were able to get the warnings like ORA-28002: the password will expire within 5 days, etc...

Same we had tried to connect through application (using Delphi5.0 using ODAC - TORASession) and not able to trap these warnings.
Let us know whether we can trap this, also whether this is possible using Delphi5.0 and Oracle8i etc
Thanks in advance.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 05 Jan 2011 08:25

Hello,

To check the 'password expired' and 'password locked' errors you can use the following code:

try
OraSession.Connect;
except
on E:EOraError do
case E.ErrorCode of
28000: ShowMessage('.....'); //locked
28001: ShowMessage('.....'); //expired
else ShowMessage('.....');
end;
end;

but to check the 'password will be expire' error you should use the OnInfoMessage event. This event was added in the 6.90.0.55 version of ODAC.
So you should upgrade your ODAC to the latest version to use this event.

Post Reply