RE: [PHP-DB] OCIPLogon
| From: | RENAULT, François | Date: | Wed, 09 Jul 2003 14:08:41 +0000 |
| Subject: | RE: [PHP-DB] OCIPLogon | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-29169@lists.php.net to get a copy of this message | ||
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:sapporo@land.ru]
Envoyé : mercredi 9 juillet 2003 16:03
À : php-db@lists.php.net
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