How to catch Oracle password grace period?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Siorg
Posts: 3
Joined: Wed 02 Dec 2009 08:54

How to catch Oracle password grace period?

Post by Siorg » Wed 02 Dec 2009 08:58

There is some posibility to catch ORA-28002 error (pasword grace period)?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 02 Dec 2009 13:43

If you mean that you need to specify whether the error is ORA-28002 or something else, this can be made using the Code property of the OracleException class. This property returns an integer specifying the error type according to the Oracle error classification. For instance, the ORA-28002 error will generate an OracleException with Code = 28002.

If you encounter problems with raising the exception for the ORA-28002 error, please give us a more detailed description of the issue and the steps we should follow to reproduce it.

Siorg
Posts: 3
Joined: Wed 02 Dec 2009 08:54

Post by Siorg » Thu 03 Dec 2009 06:19

OracleConnection con = new OracleConnection(connectionString);
try{con.Open();con.Close();message = "OK";}
catch(OracleException ex){
if (ex.Code == 28001){message = "EXPIRED";}
else if(ex.Code == 28002){message = "GRACE";}
else{ message = ex.Code.ToString();}
}

If password is expired (Oracle throws ORA-28001) then that code works as expected, if password is in grace period (must be thrown ORA-28002 error) there is no exception.

OracleDataProvider version: v2.0.50727

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 03 Dec 2009 14:28

We have investigated the problem. As ORA-28002 is an informational message and actually not an error, it throws no exception.

We have added the functionality to trace the message, it will be available in the next build. ORA-28002 will invoke the OracleConnection.InfoMessage event, and the Code property of the corresponding OracleInfoMessageEventArgs object will contain the message code (i.e. 28002).

Post Reply