OCILogon during Grace Period - ORA-28002

六月ゝ 毕业季﹏ 提交于 2019-12-12 17:22:46

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/1121718/ocilogon-during-grace-period-ora-28002

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!