Re: Combing PDO with mysql_pconnect connections in one application -- will this degrade performance?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Sara Leavitt wrote:
> How about combining  MySQLi with mysql_pconnect?  Assuming both are
> persistent, would those connections be shared?
> The goal here is to use prepared statements. I read that MySQLi only
> supports persistent connections in php version 5.3 which we are not yet
> running, but perhaps it would be worth waiting for 5.3.
>
> -Sara

The mysqli extension appears to use "mysqli_" as the hash key prefix
so there won't be PHP connection structure sharing here either.

Chris


>
>
> Christopher Jones wrote:
>>
>>
>> Andy Shellam (Mailing Lists) wrote:
>> > "First, when connecting, the function would first try to find a
>> > (persistent) link that's already open with the same host, username
>> > and password. If one is found, an identifier for it will be returned
>> > instead of opening a new connection."
>> >
>> > Therefore, providing you've configured PHP's --with-mysql and
>> > --with-pdo-mysql options with the same MySQL library, then as long
>> > as the host, username and password are the same, the same connection
>> > will be re-used for both the native (mysql_pconnect) connection and
>> > the PDO connection.
>>
>> The doc refers to the PHP end of the connection and only to any
>> existing PDO connection.  PDO uses a hash table for open connections
>> which it scans for matches when a PDO connection call is executed.
>> The hash key is unique and begins with "PDO:DBH:DSN=".  The mysql
>> extension uses "mysql_" for its hash key prefix.  This mean the PHP
>> data structures for persistent connections won't be shared between the
>> two extensions.
>>
>> Whether the MySQL client library or the MySQL database reuses any
>> connection data underneath, I don't know.  In Oracle the answer would
>> be that PDO_OCI and OCI8 connections are distinct and transactionally
>> separate (though they could share the same database connection pool if
>> one was enabled).
>>
>> Chris
>>

--
Blog: http://blogs.oracle.com/opal
Twitter:  http://twitter.com/ghrd

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux