宽限期内的 OCILogon - ORA-28002
当我使用 SQL*Plus 连接到密码进入宽限期的用户(Oracle 11g、Oracle 8i)时,我收到一条错误消息,但连接仍然成功:
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
=====================================
另一方面,在我的 C++ OCI 代码中执行 < code>OCILogon2,如果我尝试连接同一个用户,我会收到带有相同“错误”的 OCI_ SUCCESS_WITH_ INFO
,但如果我继续,则会出现 OCISvcCtx*< /code> 我得到的似乎无效(即使它不为空),因为尝试对其执行
OCIAttrGet
或 OCIStmtExecute
会给我一个 OCI_INVALID_HANDLE
代码>错误。
用户应该在整个宽限期内成功连接到数据库,直到他的密码完全过期。 那么当我得到一个错误的句柄时,为什么 SQL*Plus 可以正常连接呢? 我应该尝试以不同的方式连接吗?
非常感谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这有点超出我的经验,但由于没有人回答我会尝试一下。
我记得您可以安装某种错误处理程序回调。 由于您可以通过 OCIErrorGet (?) 获取错误信息,我认为它会触发正常的错误处理机制。 是否有可能有一个错误处理程序在发生“错误”时关闭连接而不检查这种特殊情况?
这也让我想起了很久以前遇到的一个问题,如果你将错误的句柄类型传递给 OCI 函数,它们可能会以奇怪的方式失败。 从
OCIErrorGet
文档来看,您可能传入了OCI_HTYPE_ERROR
和环境句柄,或者OCI_HTYPE_ENV
和错误句柄。您是否多次调用
OCIErrorGet
? Oracle 可能会生成多个错误,也许您必须在继续之前检索所有错误? 但这似乎不太合理。除了这些远景之外,我会尝试一个简单的 OCI 示例 或来自 Oracle 的任何示例代码,看看是否有相同的问题。 如果没有,那么就倒过来找出造成差异的原因。
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 inOCI_HTYPE_ERROR
and an environment handle, orOCI_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.