PDO to Oracle db and secure external password store aka wallet for authentication
| From: | Mathias Zarick | Date: | Tue, 28 Sep 2021 08:59:57 +0000 |
| Subject: | PDO to Oracle db and secure external password store aka wallet for authentication | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-49199@lists.php.net to get a copy of this message | ||
Hi there,
I am wondering how it would be possible to use authentication using a secure external password store
aka wallet with PDO OCI.
See Oracle external authentication and OCI_CRED_EXT in the underground php oracle manual.
and
https://docs.oracle.com/en/database/oracle/oracle-database/19/dbseg/configuring-authentication.html#GUID-803496D2-19C7-4F02-94EC-C13EDD8FB17B
(jump to chapter 3.2.9)
Following works fine with oci8:
$conn = oci_connect('/', '', $db, 'UTF8',OCI_CRED_EXT);
note the OCI_CRED_EXT!
But how can pass that option to a PDO OCI connection?
Following might be close, but does not work:
$opt = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_NUM,
'session_mode' => OCI_CRED_EXT,
];
try{
$conn = new PDO("oci:dbname=".$db.';charset=UTF8',
"/","", $opt);
}
catch(PDOException $e){
echo ($e->getMessage());
}
Is it possible at all?
Thanks in Advance
Mathias Zarick