ID:               29013
 User updated by:  cjbj at hotmail dot com
 Reported By:      cjbj at hotmail dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         OCI8 related
-Operating System: Windows, Linus
+Operating System: Windows, Linux
 PHP Version:      4.3.7, 5.0.0 Dev
 Assigned To:      tony2001
 New Comment:

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".


Previous Comments:
------------------------------------------------------------------------

[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.

------------------------------------------------------------------------

[2004-08-13 05:32:39] cjbj at hotmail dot com

The given testcase has an extra semi-colon in the second query.  The
new testcase below shows that the initial connection is getting
associated with the second user.

Testcase:

<?php
  function qry(&$c, $s) {
      echo "===&gt;BEGIN<br>";
      $rSth = OCIParse($c, $s);
      $rRet = OCIExecute($rSth);
      echo "<br>";
      while ($succ = OCIFetchInto($rSth, $row)) {
        foreach ($row as $item) {
          echo ($item?htmlentities($item):'&nbsp;')." ";
        }
        echo "<br>\n";
      }
      echo "===&gt;CLOSE<br><br>";
      ocifreestatement($rSth);
  }

  $statement1 = "select user from dual";

  echo "===&gt;OCINLogin #1: Connect as SCOTT<br>";
  $c1 = OCINlogon('scott', 'tiger', 'F10D' );

  echo "===&gt;Query first connection<br>";
  qry($c1, $statement1);

  echo "===&gt;OCINLogin #2: Connect as HR<br>";
  $c2 = OCINlogon('hr', 'hr', 'F10D');

  echo "===&gt;Re-query first connection<br>";
  qry($c1, $statement1);

?>

Actual Output:

===>OCINLogin #1: Connect as SCOTT
===>Query first connection
===>BEGIN

SCOTT
===>CLOSE

===>OCINLogin #2: Connect as HR
===>Re-query first connection
===>BEGIN

HR
===>CLOSE


Expected output is similar with the usernames in this order: SCOTT,
SCOTT

------------------------------------------------------------------------

[2004-07-05 09:38:01] cjbj at hotmail dot com

Description:
------------
Multiple logons within the same request cause handles to become invalid
and queries to fail.  

Also see:
http://forums.oracle.com/forums/thread.jsp?forum=178&thread=251141

To reproduce, restart Apache and run the following file.

The same incorrect output occurs with ocilogon() inplace of
ocinlogon().


Reproduce code:
---------------
  <?php
  ociinternaldebug(1);

  function qry(&$c, $s) {
      echo "<br>===&gt;BEGIN<br><br>";
      $rSth = OCIParse($c, $s);
      $rRet = OCIExecute($rSth);
      echo "<br>";
      while ($succ = OCIFetchInto($rSth, $row)) {
        foreach ($row as $item) {
          echo ($item?htmlentities($item):'&nbsp;')." ";
        }
        echo "<br>\n";
      }
      echo "<br>===&gt;CLOSE<br><br>";
      ocifreestatement($rSth);
  }

  $statement1 = "select dname from dept";
  $statement2 = "select user from dual;";

  echo "<br>===&gt;OCINLogin #1<br><br>";
  $c1 = OCINlogon('scott', 'tiger', 'MYDB' );

  echo "<br>===&gt;Query first connection<br><br>";
  qry($c1, $statement1);

  echo "<br>===&gt;OCINLogin #2<br><br>";
  $c2 = OCINlogon('hr', 'hr', 'MYDB');

  echo "<br>===&gt;Re-query first connection<br><br>";
  qry($c1, $statement1);

  echo "<br>===&gt;Re-query first connection<br><br>";
  qry($c1, $statement2);

  ?>


Expected result:
----------------
Three queries are successfully completed.

Actual result:
--------------
  ===>OCINLogin #1

  OCIDebug: _oci_open_server new conn=0 dname=MYDB
  OCIDebug: _oci_open_session new sess=3 user=scott
  OCIDebug: oci_do_connect: id=4

  ===>Query first connection
  ===>BEGIN

  OCIDebug: oci_parse "select dname from dept" id=5 conn=4

  ACCOUNTING
  RESEARCH
  SALES
  OPERATIONS

  ===>CLOSE

  OCIDebug: START _oci_stmt_list_dtor: id=5 last_query="select dname
from dept"
  OCIDebug: START _oci_column_hash_dtor: DNAME
  OCIDebug: END _oci_column_hash_dtor: DNAME
  OCIDebug: END _oci_stmt_list_dtor: id=5

  ===>OCINLogin #2

  OCIDebug: _oci_open_session new sess=6 user=hr
  OCIDebug: oci_do_connect: id=7

  ===>Re-query first connection

  ===>BEGIN

  OCIDebug: oci_parse "select dname from dept" id=8 conn=4

  Warning: ociexecute(): OCIStmtExecute: ORA-00942: table or view does
not exist in c:\cj\php\cj\contest.php on line 13

  Warning: ocifetchinto(): OCIFetchInto: ORA-24374: define not done
before fetch or execute and fetch in c:\cj\php\cj\contest.php on line
15

  ===>CLOSE

  OCIDebug: START _oci_stmt_list_dtor: id=8 last_query="select dname
from dept"
  OCIDebug: END _oci_stmt_list_dtor: id=8

  ===>Re-query first connection

  ===>BEGIN

  OCIDebug: oci_parse "select user from dual;" id=9 conn=4

  Warning: ociexecute(): OCIStmtExecute: ORA-00911: invalid character
in c:\cj\php\cj\contest.php on line 13

  Warning: ocifetchinto(): OCIFetchInto: ORA-24374: define not done
before fetch or execute and fetch in c:\cj\php\cj\contest.php on line
15

  ===>CLOSE

  OCIDebug: START _oci_stmt_list_dtor: id=9 last_query="select user
from dual;"
  OCIDebug: END _oci_stmt_list_dtor: id=9
  OCIDebug: START php_rshutdown_oci
  OCIDebug: END php_rshutdown_oci
  OCIDebug: START _oci_conn_list_dtor: id=4
  OCIDebug: nothing to do..
  OCIDebug: START _oci_close_session: logging-off sess=3
  OCIDebug: END _oci_conn_list_dtor: id=4
  OCIDebug: START _oci_conn_list_dtor: id=7
  OCIDebug: nothing to do..
  OCIDebug: START _oci_close_session: logging-off sess=6
  OCIDebug: END _oci_conn_list_dtor: id=7
  OCIDebug: START _oci_close_server: detaching conn=2 dbname=MYDB



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29013&edit=1

Reply via email to