PDO to Oracle db and secure external password store aka wallet for authentication

[email protected] (Mathias Zarick) Tue, 28 Sep 2021 08:59:57 +0000
Newsgroups php.db
Message-ID <AM6PR05MB5960F54F78502791380E3051FEA89@AM6PR05MB5960.eurprd05.prod.outlook.com>
--_000_AM6PR05MB5960F54F78502791380E3051FEA89AM6PR05MB5960eurp_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi there,

I am wondering how it would be possible to use authentication using a secur=
e 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/configu=
ring-authentication.html#GUID-803496D2-19C7-4F02-94EC-C13EDD8FB17B
(jump to chapter 3.2.9)


Following works fine with oci8:
$conn =3D 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 =3D [
      PDO::ATTR_ERRMODE =3D> PDO::ERRMODE_EXCEPTION,
      PDO::ATTR_DEFAULT_FETCH_MODE =3D> PDO::FETCH_NUM,
      'session_mode' =3D> OCI_CRED_EXT,

];

  try{
      $conn =3D new PDO("oci:dbname=3D".$db.';charset=3DUTF8', "/","", $opt=
);
  }
  catch(PDOException $e){
      echo ($e->getMessage());
  }

Is it possible at all?

Thanks in Advance
Mathias Zarick

--_000_AM6PR05MB5960F54F78502791380E3051FEA89AM6PR05MB5960eurp_--