How to Connect mssql database

I tried using PDO emulation library. http://www.yiiframework.com/extension/phppdo




...

   'db'=>array(

      'class'=>'application.extensions.PHPPDO.CPdoDbConnection',

      'pdoClass' => 'PHPPDO',

      ...

      ),

   ...



I got the same error while setting up a local dev environment using Apache 2.2, PHP 5.3 and SQL Express 2008.

In my case I had the incorrect database connection string.

The following worked for me:


'db'=>array(

	'connectionString' => 'sqlsrv:server=localhost\sqlexpress;database=[database name]',

	'username' => '[username]',

	'password' => '[password]',

),

Thanks for the links mdomba.

Seem I’m no luck.

I try with below connctionString. (Actually ,tested with many method which can dig and found )

‘db’=>array(

        'connectionString' => 'sqlsvr:server=dvlserver1;database=Employee;',


        'username' => 'sa',


        'password' => 'nomsod999$$',


     ),

This is Error

CDbConnection failed to open the DB connection: could not find driver

I coding from laptop (windows 7) and connect to MSSQL Server 2008

Help me please…

Foon

It’s sqlsrv (not sqlsvr).

/Tommy

Thank you Tommy,

I already change to sqlsrv

no luck

still error .

CDbConnection failed to open the DB connection: could not find driver

foon.

Is the sqlsrv driver correctly installed? Can you see it in the phpinfo report?

/Tommy

I have the same problem trying to connect to mssql.

My first error was:

CDbConnection failed to open the DB connection: could not find driver

After reading this topic I tried the solution from Donal


'db'=>array(

      'class'=>'application.extensions.PHPPDO.CPdoDbConnection',

      'pdoClass' => 'PHPPDO'

      'connectionString' => 'mssql:Server=ZELUS\NAV51;Database=test',

      'emulatePrepare' => false,

      'username' => 'test',

      'password' => 'test',

      'charset' => 'utf8',

    ),

The error I get now is a lot different:

PHP warning

include(phppdo_sybase_statement.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory

C:\xampp\yii\framework\YiiBase.php(418)

Does anybody know how to solve this?

Thanks.

Hi Jellic

Did you or anyone else figure out the problem with the include(phppdo_sybase_statement.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory

C:\xampp\yii\framework\YiiBase.php(418) error

because I’m getting the same problem after downloading the PDO extension. Not sure what the problem is or how to solve it. I been searching online but no luck

thanks

Can you write how you solved it, Please?

How to generate CRUD with MSSQL