This is a discussion on Can any one explain about the Persistent Database Connections in php? within the PHP Programming forums, part of the Web Development category; Can any one help me to know about the Persistent Database Connections in php? Thanks Falcon...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Persistent connections are SQL links that do not close when the execution of your script ends. When a persistent connection is requested, PHP checks if there's already an identical persistent connection (that remained open from earlier) - and if it exists, it uses it. If it does not exist, it creates the link. An 'identical' connection is a connection that was opened to the same host, with the same username and the same password (where applicable).
__________________ $enthil |
| |||
| To know more on this Kindly go to PHP: Persistent Database Connections - Manual
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| Thanks For the information about Persistent Database Connection. A doubt arise for me. Then why dont we use that Persistent Database Connection. what is it drawback buddies Thanks Falcon ![]() |
| |||
| Drawbacks of Persistent Connections If you are using a database with connection limits that are exceeded by persistent child connections. If your database has a limit of 16 simultaneous connections, and in the course of a busy server session, 17 child threads attempt to connect, one will not be able to. If there are bugs in your scripts which do not allow the connections to shut down (such as infinite loops), the database with only 16 connections may be rapidly swamped. Check your database documentation for information on handling abandoned or idle connections. There are a couple of additional caveats to keep in mind when using persistent connections. One is that when using table locking on a persistent connection, if the script for whatever reason cannot release the lock, then subsequent scripts using the same connection will block indefinitely and may require that you either restart the httpd server or the database server. Another is that when using transactions, a transaction block will also carry over to the next script which uses that connection if script execution ends before the transaction block does. In either case, you can use register_shutdown_function() to register a simple cleanup function to unlock your tables or roll back your transactions. Better yet, avoid the problem entirely by not using persistent connections in scripts which use table locks or transactions (you can still use them elsewhere). |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Create connections between your ColdFusion Web sites and databases? | vigneshgets | ColdFusion Programming | 3 | 11-26-2008 02:42 AM |
| Difference between Regular database connection and Persistent Database Connections? | Falcon | PHP Programming | 1 | 11-03-2007 05:13 AM |
| What Is a Persistent Cookie? | Sabari | PHP Programming | 19 | 09-21-2007 08:29 AM |
| # What is the role of the DataReader class in ADO.NET connections? | anbuchezhians | VB.NET Programming | 1 | 07-27-2007 02:44 AM |
| I need to find out how many client connections were aborted by MySQL server | Sabari | Database Support | 1 | 07-17-2007 04:34 AM |