Re: persistent database connections with OCI

From: Date: Tue, 08 Aug 2000 01:24:16 +0000
Subject: Re: persistent database connections with OCI
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-10593@lists.php.net to get a copy of this message
Hello thies, On 06-Aug-00 08:16:44, you wrote: >> >Is there a implicit commit or even rollback ? Do I have to code a commit >> >for this reason ? >> >> You should never leave a script without ending opened transactions if you >> use persistent connections with PHP as Web server module. While the >> connection is kept opened data is left uncommitted and the database server >> keeps implicit locks, eventually stalling other database accesses. > no longer true. > NEWS: >- Uncommitted outstanding OCI8 transactions are now rolled back > before the connection is closed. (Thies) What happens if the connection is persistent? With Metabase, when at least one transaction is started it calls register_shutdown_function() to make sure that any pending transactions at the end of the script are rolled back. That works will all databases supported by Metabase including Oracle, even when the connections are persistent (do not end at script exit) and even your script exited due to a fatal PHP error that does not end the Web server process (the connection is not broken implicitly). I realized this problem when I was developing Metabase PostgreSQL driver, but not everybody uses Metabase or any other database abstraction package that avoids the problem. It would be good if all PHP had some kind of built-in protection for all API of databases that support transactions. >> >Do I have to free any resources ? >> >> You should. > but don't have to - wonderful world of automatic resource > deallocation! Yes, but only at the end of the script. It's a good thing to keep freeing resources because PHP memory allocation manager may reuse them for other things. Regards, Manuel Lemos Web Programming Components using PHP Classes. Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org -- E-mail: mlemos@acm.org URL: http://www.mlemos.e-na.net/ PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp --

« previous php.general (#10593) next »