[PHP-DB] Re: [External] : [PHP-DB] PDO to Oracle db and secure external password store aka wallet for authentication
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
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
[PHP-DB] PDO and Oracle
Folks, I was looking at rewriting some old DB classes using PDO with the Oracle driver, but I'm a bit confused about the current state of things. Some docs said the PDO Oracle driver was experimental and subject to change. I also had a hard time trying to get the driver to compile against Oracle's instant client. Are people using PDO and Oracle in production environments? Am I just being dense and unable to find a guide to compile against the instant client? Thanks for the input. Roberto -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] pdo and oracle drivers
Hello, I've been playing around with PDO and oracle drivers. PDO seems to be the right way to go, but the oracle implementation it is still very immature and prepare statements don't seem to work. I am using oracle instant client 10.2 The problems I found are when doing prepared statements. If I use bindParam or bindValue, when executing the statement, with errorInfio() I get this: OCIStmtExecute: ORA-24343: user defined callback error (php-5.1.2/ext/pdo_oci/oci_statement.c:142) and PHP throws this warning: Debug Warning: Session_PDO.class.php line 95 - PDOStatement::execute() [a href='function.execute'function.execute/a]: param is NULL in oci_bind_input_cb; this should not happen Now, If I instead execute the statement and do the binding at the same time, I don't get any errors, but the fields in the table are inserted empty. I am doing this: $stmt-execute( array( ':value' = $val, ':random' = md5(uniqid(rand(),1)), ':session_id' = $key ) ); I also tried binding with the value names like :random and with numbers and getting the same results. Any ideas if I am doing something wrong or if the oracle implementation is still so immature. If this is so, what are the plans to get this implementation along the status of mysql (which I tried and it works fine). I appreciate any feedback, Pablo Godel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php