the first OCIexecute($statement, OCI_DEFAULT); 
has not been commited
so when you reconnect ,  your cursor is closed and rollbacked with the 2nd PLogon 

-----Message d'origine-----
De : Sapporo [mailto:[EMAIL PROTECTED]
Envoyé : mercredi 9 juillet 2003 16:03
À : [EMAIL PROTECTED]
Objet : [PHP-DB] OCIPLogon


Hi,

I'm trying to avoid excessive database connections within my app.

 From the docs, I figured that the following code would insert 2 rows of 
data into table Dummy, since the connection would be reused and the 
transactions aren't isolated by using OCINLogon() (error handling left 
out for readability):

$conn = OCIPLogon("scott", "tiger", "testdb");
$statement = OCIparse($conn, "INSERT INTO Dummy VALUES ('A')");
OCIexecute($statement, OCI_DEFAULT);

$conn = OCIPLogon("scott", "tiger", "testdb");
$statement = OCIparse($conn, "INSERT INTO Dummy VALUES ('B')");
OCIexecute($statement, OCI_DEFAULT);

OCICommit($conn);

But it turns out that only the second row gets written to the database. 
So, what difference would it make to use OCINLogon()? Is this the 
expected behaviour?

How does everyone else handle this? Is it possible to store database 
connections in a session?

TIA,
-sapporo.

BTW, I'm using PHP 4.3 on Linux talking to Oracle9i.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to