[PHP-DB] Re: [External] : [PHP-DB] PDO to Oracle db and secure external password store aka wallet for authentication

2021-09-28 Thread Christopher Jones



On 28/9/21 6:59 pm, Mathias Zarick wrote:

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?


You can see in the PDO_OCI source code there is no reference to the OCI_CRED_EXT constant which is needed to tell the Oracle client libraries to use 
external authentication.


PR's are welcome.

For the moment stick with OCI8.  In general, native drivers (e.g OCI8) will be 
better than any of the PDO abstractions.

Chris




Thanks in Advance
Mathias Zarick


--
https://twitter.com/ghrd

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] PDO to Oracle db and secure external password store aka wallet for authentication

2021-09-28 Thread Mathias Zarick
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