Description:
------------
I've only verified this in PHP 5.3.10, but I checked that the relevant code has not changed in git/master.
Enabling persistent connection to Oracle 9.2 servers does not work. The server seem to brutally kill the connection on OCIPing, a function the code in ext/pdo/oci_driver.c:pdo_oci_check_liveness() assumes will fail gracefully on older Oracle versions.
This makes the error_code == 1010 check fail and it will (now correctly) re-connect to the server, saving the day by not failing in a user-visible way, but however rendering persistent connections to 9.2 servers useless and adding ~900ms of extra latency (in our case).
I tried extending the check to the resulting 3113 (end-of-file on communication channel) error, but it turned out the connection really is dead at that point.
Is there really any downside to just using OCIServerVersion instead of OCIPing?
Test script:
---------------
<?php
$pdo = new PDO(
'oci:dbname=//dbserver/dbname',
'user',
'pass',
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_PERSISTENT => true)
);
?>
Expected result:
----------------
connections not beeing re-established (source port numbers in netstat -anp not changing)
Actual result:
--------------
connections beeing re-established (source port numbers in netstat -anp changing), incurring a large latency penalty.

Patches

Pull Requests

History

Check you have the latest Oracle DB patchset 9.2.0.8 and latest Oracle
11.2 client. Look for Oracle traces. Utilize Oracle Support to
identify the cause and find a remedy. I've not seen other reports of
problems. Does the OCI8 extension have the same problem?
OCIServerVersion and OCIPing check different things. The latter can
check more to provide better reliability. If your same PHP code
connects to multiple Oracle DB versions, perhaps you could modify the
PDO_OCI source and add a runtime check to determine which function to
use?
Oracle 9.2 was released in 2002. Oracle's Extended Support for it
finished in 2010. (Ref:
http://www.oracle.com/us/support/library/lifetime-support-technology-
069183.pdf)
The PDO_OCI extension currently does not have a maintainer. The
OCI8 extension does, and has better functionality. Using OCI8
is preferred.