Page 1 of 1

Oracle Warnings to be trapped

Posted: Wed 05 Jan 2011 04:49
by mohamedsuhail
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.

Posted: Wed 05 Jan 2011 08:25
by AlexP
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.