Using PHP 5.5.9 with PDO_OCI, Oracle 12.1. I'm getting an OCI_SUCCESS_WITH_INFO message that the password will expire soon. However, since it is thrown as an exception by PDO, the connection is not being established. How can I ignore the exception when it is just a warning or informational message?
Here is the error message:
Database Connection failed: SQLSTATE[HY000]: OCISessionBegin: OCI_SUCCESS_WITH_INFO: ORA-28002: the password will expire within 41 days
Followed by:
Fatal error: Call to a member function setAttribute() on a non-object in /htdocs/ciatools_dev/promise/Classes/PromiseVars.php on line 257
And the code that produces it:
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);
If this is a test system try changing the password of the user to see if resolves the error message. This thread has more details
alter user <your user> identified by password;
You could also alter the profile of that user so it does not expire which is acceptable on development but a security issue on production.
--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;