tags:

views:

94

answers:

1

Hi,

when I use SQL*Plus, connecting to a user whose password entered the grace period (Oracle 11g, Oracle 8i), I get an error message but the connect is still successful:

SQL*Plus:

=====================================

SQL> connect gumiplesku Enter password: ERROR: ORA-28002: the password will expire within 7 days

Connected. SQL> select User from dual;

USER

======================================

gumiplesku

=====================================

On the other hand, in my C++ OCI code doing a OCILogon2, if I try to connect the same user, I get an "OCI_ SUCCESS_ WITH_ INFO" with the same "error", but if I continue, the OCISvcCtx* I got seems to be invalid (even though it's not null), since trying to do a OCIAttrGet or OCIStmtExecute on it gives me an OCI_ INVALID_ HANDLE error.

User should successfuly connect to database during all his grace period, until his password will be totally expired. So how come SQL*Plus can connect OK, when I get a bad handle? Shall I be attempting to connect a different way?

Many thanks.

A: 

This is a little outside my experience, but since nobody is answering I'll give it a shot.

I recall there being some kind of error handler callback you can install. Since you are able to get the error information via OCIErrorGet (?), I assume it's triggering normal error handling mechanisms. Is it possible that there's an error handler that closes the connection when an "error" occurs without checking for this special case?

This also reminds me of a problem I had long ago, if you pass in the wrong handle type to OCI functions they can fail in odd ways. From a look at the OCIErrorGet docs, it might be that you're passing in OCI_HTYPE_ERROR and an environment handle, or OCI_HTYPE_ENV and an error handle.

Are you calling OCIErrorGet multiple times? Oracle can generate multiple errors, maybe you have to retrieve them all before continuing? But that doesn't really seem reasonable.

Beyond those long-shots, I would try a simple OCI example or any example code from Oracle to see if it has the same issue. If not, then work backwards to find what's making the difference.

Tim Sylvester