Re: [PDO] Question on Persistent PDO Connections

From: Date: Fri, 06 Nov 2009 13:12:19 +0000
Subject: Re: [PDO] Question on Persistent PDO Connections
References: 1 2 3 4 5 6 7 8 9  Groups: php.pdo 
Request: Send a blank email to pdo+get-314@lists.php.net to get a copy of this message
Ulf Wendel wrote:
Lester Caine schrieb:
Ulf Wendel wrote:
Lukas Kahwe Smith schrieb:
well for mysql traditonally persistent connections came with the risk of an unclean session. i guess there is now a solution to clean up the session fairly well, making persistent connections more feasible,
COM_CHANGE_USER/mysql_change_user() cleans up the line. The call itself exists since quite some time. In its early days (say more than three years ago) it was known to have issues. But its working fine nowadays. Its possible to clean up the line before reuse, if wanted. Calling mysql_change_user is the default for ext/mysqli. However, if you know what you do, you may not want to clean the line for performance reasons.
Actually Ulf that sounds a little strange when the mechanism to use an existing connection is that your new connection MUST have the same username and password. Ideally I think, there should be nothing
Not sure if I get what you say. mysql_change_user() (C API [1], protocol command COM_CHANGE_USER) is the MySQL way of resetting an existing connection. After the call the connection is as if its new. As server permissions can change between putting a connection into a persistent pool and reusing a connection, it is necessary to re-authenticate the user.
We are currently discussing persistent connctions http://de.php.net/manual/en/function.mysql-pconnect.php in the case of MySQL and using pconnect re-uses a previous connection if the username and password are the same. Actually when I look at mysql_change_user() http://de.php.net/manual/en/function.mysql-change-user.php it says it deprecated. In any case, pconnect would only fail if the user's credentials had changed which would be the same as for a simple 'connect' -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php

« previous php.pdo (#314) next »