Re: persistent database connections with OCI

From: Date: Tue, 08 Aug 2000 10:16:27 +0000
Subject: Re: persistent database connections with OCI
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-10619@lists.php.net to get a copy of this message
On Mon, Aug 07, 2000 at 10:24:16PM -0300, Manuel Lemos wrote: > 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? it will still rollback uncomitted stuff at script-end. > > 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). exactly what the oci-driver does automagicaly. > > 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. if a db-driver doesn't do it i would even call it a _bug_. (see you comment at the beginning of the mail). > > > >> >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. right. tc > > > > > 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 > -- -- Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!" Digital Collections Phone +49 40 235350 Fax +49 40 23535180 Hammerbrookstr. 93 20097 Hamburg / Germany

« previous php.general (#10619) next »