I was just investigating persistent database connection and I came across this in PHP PDO documentation
The way Yii sets persistent connection is like so;
public function setPersistent($value)
Which in turns use the following.
public function setAttribute($name,$value)
if($this->_pdo instanceof PDO)
The connection is established like so using ‘$this->_attributes’ which will only get set for ATTR_PERSITENT if the PDO object was not created yet.
protected function createPdoInstance()
if($driver==='mssql' || $driver==='dblib')
return new $pdoClass($this->connectionString,$this->username,$this->password,$this->_attributes);
At this stage, I am inclined to draw the conclusion that CDbConnection does not support Persistent connection by default, one has to at least set autoConnect=false before trying to use persistent database connections.
If my conclusions are correct, it would be nice to document this somewhere, if so where?
Sorry, but I got a little bit lost here. What is the conclusion of this discussion? is setting persistent to TRUE enough to have persistent connection to DB or setting autoConnect to FALSE is also necessary.