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 attribute!
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? Thank you very much!
It's not possible with PDO_OCI. The implementation doesn't set OCI_CRED_EXT anywhere, unlike with OCI8. If you're using Oracle Cloud ADB, note that wallets are now optional. If you use Instant Client 19.14 or 21.5 you can use 1-way ("walletless") TLS, similar to shown in https://towardsdev.com/connect-to-oracle-autonomous-database-from-python-without-using-the-instance-wallet-64bd16e4f31c
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.