CHEN SEI-LIM writes:
> How could you know DBD::Oracle can't be shared after forking?
> How could you prove it?
> Have you made a program to try it?
> If you have not, try it then please tell me the result.
The following script results in the parent failing with:
DBD::Oracle::db prepare failed: ORA-12571: TNS:packet writer failure
(DBD ERROR: OCIStmtExecute/Describe) ...
Moving wait and fork around so that different statements execute in
parallel gives, at best:
DBD::Oracle::st fetchrow_hashref failed: ORA-12592: TNS:bad packet
(DBD ERROR: OCIStmtFetch) ...
DBD::Oracle::st fetchrow_hashref failed: ORA-12569: TNS:packet
checksum failure (DBD ERROR: OCIStmtFetch) ...
and an "Internal heap ERROR" with various (probably spurious) Oracle
errors at worst.
----------------------------------------
use DBI;
$db = DBI->connect(...)
or die $DBI::errstr;
$pid = fork;
if ($pid) {
# parent
wait;
$st = $db->prepare("select * from customer");
$st->execute;
while ($st->fetchrow_hashref) {};
} else {
# child
$st = $db->prepare("select * from customer");
$st->execute;
while ($st->fetchrow_hashref) {};
}
----------------------------------------