ID: 29013
Comment by: support at madern dot com
Reported By: cjbj at hotmail dot com
Status: Analyzed
Bug Type: OCI8 related
Operating System: Windows, Linux
PHP Version: 4.3.7, 5.0.0 Dev
Assigned To: tony2001
New Comment:
Hi, i think i have a problem that could be related to this bug.
This script works fine when multiple users are loading the page at the
same time.
<?php
$q1 = '
SELECT QUERY1.*,
QUERY2.*,
BAAN.TTIROU003910.T$DSCA,
BAAN.TTIROU003910.T$TANO
FROM BAAN.TTIROU003910,
(SELECT BAAN.TTISFC010910.T$PDNO,
BAAN.TTISFC010910.T$OPNO,
BAAN.TTISFC010910.T$COMP,
BAAN.TTISFC010910.T$TANO
FROM BAAN.TTISFC010910
WHERE BAAN.TTISFC010910.T$COMP = 2)QUERY1,
(SELECT BAAN.TTISFC001910.T$CPRJ,
BAAN.TTISFC001910.T$PDNO
FROM BAAN.TTISFC001910)QUERY2
WHERE QUERY2.T$PDNO=QUERY1.T$PDNO
AND QUERY1.T$TANO=BAAN.TTIROU003910.T$TANO
ORDER BY QUERY1.T$PDNO,QUERY1.T$OPNO';
$conn = OCILogon($user, $pass, $tns);
$mycursor = OCI_Parse($conn, $q1);
oci_execute($mycursor, OCI_DEFAULT);
echo"<table>";
while ($row = oci_fetch_array ($mycursor, OCI_BOTH)) {
$aant=oci_num_rows($mycursor);
echo "
<tr>
<td>$row[4]</td>
<td>$row[0]</td>
<td>$row[1]</td>
<td>$row[6]</td>
<td>$row[2]</td>
</tr>
";
}
echo"</table>";
oci_close($mycursor);
?>
Now here is my second script with just one difference in the script
(see QUERY2).
This script gives several types of error messages when multiple users
are loading the page in their browsers at the same time:
------------
Warning: oci_fetch_array() [function.oci-fetch-array]: OCIFetchInto:
ORA-01001: invalid cursor
------------
Warning: oci_execute() [function.oci-execute]: OCIStmtExecute:
ORA-24324: service handle not initialized
Warning: oci_fetch_array() [function.oci-fetch-array]: OCIFetchInto:
ORA-24338: statement handle not executed
------------
<?php
$q1 = '
SELECT QUERY1.*,
QUERY2.*,
BAAN.TTIROU003910.T$DSCA,
BAAN.TTIROU003910.T$TANO
FROM BAAN.TTIROU003910,
(SELECT BAAN.TTISFC010910.T$PDNO,
BAAN.TTISFC010910.T$OPNO,
BAAN.TTISFC010910.T$COMP,
BAAN.TTISFC010910.T$TANO
FROM BAAN.TTISFC010910
WHERE BAAN.TTISFC010910.T$COMP = 2)QUERY1,
(SELECT BAAN.TTISFC001910.T$CPRJ,
BAAN.TTISFC001910.T$PDNO
FROM BAAN.TTISFC001910
WHERE BAAN.TTISFC001910.T$CPRJ LIKE \''.$projectnr.'\'
AND BAAN.TTISFC001910.T$PDNO LIKE \''.$ordernr.'\')QUERY2
WHERE QUERY2.T$PDNO=QUERY1.T$PDNO
AND QUERY1.T$TANO=BAAN.TTIROU003910.T$TANO
ORDER BY QUERY1.T$PDNO,QUERY1.T$OPNO';
$conn = OCILogon($user, $pass, $tns);
$mycursor = OCI_Parse($conn, $q1);
oci_execute($mycursor, OCI_DEFAULT);
echo"<table>";
while ($row = oci_fetch_array ($mycursor, OCI_BOTH)) {
$aant=oci_num_rows($mycursor);
echo "
<tr>
<td>$row[4]</td>
<td>$row[0]</td>
<td>$row[1]</td>
<td>$row[6]</td>
<td>$row[2]</td>
</tr>
";
}
echo"</table>";
oci_close($mycursor);
?>
Previous Comments:
------------------------------------------------------------------------
[2004-10-17 06:51:42] [EMAIL PROTECTED]
I can see the problem now.
Will look at it closer a bit later..
------------------------------------------------------------------------
[2004-10-14 10:11:36] cjbj at hotmail dot com
Using one user would make it harder to demonstrate the
problem. Sorry I didn't include create user scripts etc.
I retested with 4.3.10-dev and 5.0.3-dev binaries of a few
minutes ago. I am using W2K with Oracle 9.2 client libraries.
I am still seeing the usernames printed as SCOTT and HR,
which is "incorrect".
------------------------------------------------------------------------
[2004-10-12 07:20:03] [EMAIL PROTECTED]
No, of course you should able to connect to Oracle from PHP using
different logins.
My question should be read in this way: "are you able to reproduce it
under 1 user, but with different connections, because I was too lazy to
create a new user in Oracle?".
Btw, I've already created additional user and tested your code - your
example works perfectly for me.
------------------------------------------------------------------------
[2004-10-12 05:38:56] cjbj at hotmail dot com
The "business requirement" comes from the original report in
http://forums.oracle.com/forums/thread.jsp?forum=178&thread=251141
I don't think the way $c1 is impacted by the second login is obvious
or nice behavior.
I feel the problem is related to some of the common OCI8 connection
issues due to the caching and reuse of handles. It would be nice to
resolve these issues.
There is no Oracle-OCI reason why two users can't be connected at one
time. I think it should be allowed in PHP. But if you think the
PHP-OCI8 interface should not support concurrent connections, can a
PHP error be generated at the time of the second OCINLogin()?
------------------------------------------------------------------------
[2004-10-10 17:02:43] [EMAIL PROTECTED]
Chris, is it important to have different users in your example?
Tested under 1 user (but using ociNlogin();) and it works fine.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/29013
--
Edit this bug report at http://bugs.php.net/?id=29013&edit=1