gpt4 book ai didi

php - PDO OCI : Success with Info exception

转载 作者:行者123 更新时间:2023-12-05 01:27:36 24 4
gpt4 key购买 nike

使用 PHP 5.5.9 和 PDO_OCI,Oracle 12.1。我收到一条 OCI_SUCCESS_WITH_INFO 消息,提示密码即将过期。但是,由于 PDO 将其作为异常抛出,因此无法建立连接。当异常只是一条警告或信息性消息时,我该如何忽略它?

这是错误信息:

Database Connection failed: SQLSTATE[HY000]: OCISessionBegin: OCI_SUCCESS_WITH_INFO: ORA-28002: the password will expire within 41 days

其次是:

Fatal error: Call to a member function setAttribute() on a non-object in /htdocs/ciatools_dev/promise/Classes/PromiseVars.php on line 257

以及生成它的代码:

try {
$this->dbconn = new PDO("oci:dbname=$dbwc",'username', 'password');
} catch (PDOException $e) {
echo 'Database Connection failed: ' . $e->getMessage();
}

$this->dbconn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

最佳答案

如果这是一个测试系统,请尝试更改用户密码以查看是否可以解决错误消息。 This thread has more details

alter user <your user> identified by password;

您还可以更改该用户的个人资料,使其不会过期,这在开发中是可以接受的,但在生产中存在安全问题。

--get the the profile 
SELECT profile FROM dba_users WHERE username = <'Your user'>;
--change the profile
ALTER PROFILE <this user's profile> LIMIT PASSWORD_LIFE_TIME UNLIMITED;

关于php - PDO OCI : Success with Info exception,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35272785/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com