MSSQL dblib "does not support getting attributes"

I have a second database connection (extended CActiveRecord and created a new connection called “dw”) that connects to a remote SQL Server 2005 instance. Yii server is running Ubuntu 10.04 LTS, PHP 5.3.2 with dblib sybase/freetds. I’m using yii debug toolbar, which causes the issue to occur. When I disable it, the error goes away. A query I run on the page works fine, it seems to just be the toolbar executing some framework code that doesn’t work.

DB configuration:



	'connectionString' => 'dblib:host=ip:port;dbname=dbname;',

	'username' => 'username',

	'password' => 'password',

	'charset' => 'utf8',

	'tablePrefix' => 'blah_'


On pages that use the second database, I get the following:

SQLSTATE[IM001]: Driver does not support this function: driver does not support getting attributes


722         return $this->getAttribute(PDO::ATTR_TIMEOUT);

723     }


725     /**

726      * Obtains a specific DB connection attribute information.

727      * @param integer $name the attribute to be queried

728      * @return mixed the corresponding attribute information

729      * @see

730      */

731     public function getAttribute($name)

732     {

733         $this->setActive(true);

734         return $this->_pdo->getAttribute($name);

735     }


737     /**

738      * Sets an attribute on the database connection.

739      * @param integer $name the attribute to be set

740      * @param mixed $value the attribute value

741      * @see

742      */

743     public function setAttribute($name,$value)

744     {

745         if($this->_pdo instanceof PDO)

746             $this->_pdo->setAttribute($name,$value);

Any thoughts on this? Is this really a driver problem or something Yii could fix or I could work around? Thanks.

From my experience with SQL Server, you should use Microsoft’s PDO driver, and use this connection string:

'connectionString' => 'sqlsrv:Server=host;Database=dbname',

Microsoft’s sqlsrv driver only works in Windows. I’m running a Linux server. Wish I could use it, but can’t.

The Yii Debug Toolbar developer says he will fix the problem tomorrow. I’ll update here with the result.