Make CakePHP work with SQL Server 2008

advertisements

I can call SQL server 2008 from PHP with Microsoft Drivers for PHP for SQL Server ( http://www.microsoft.com/download/en/details.aspx?id=20098) But as Sqlsvr driver class is needed to use CakePHP with SQL server 2008, I got the driver file from following repository ( https://github.com/revathskumar/CakePHP-sqlsrv-driver)

However, when running my test cakephp with following database.php

 <?php
 class DATABASE_CONFIG {

    var $default = array(
    'driver' => 'sqlsvr',
    'host' => 'localhost\EPHP',
    'login' => 'sa',
    'password' => 'xxxxxxx',
    'database' => 'Blog',
    );
  }
  ?>

I got following error.

Fatal Error (256): ConnectionManager::loadDataSource - Unable to import DataSource class .DboSqlsvr [CORE\cake\libs\model\connection_manager.php, line 185]

Then I have read all the you-cannot-make-cakePHP-work-with-sql-2008 discussions ( http://groups.google.com/group/cake-php/browse_thread/thread/aa6da91e842e6e9f). Is there any resolution by now?

UPDATE: Let me rephrase my question. I would appreciate if someone successfully made CakePHP work with SQL 2008 and tell me the procedure he followed to do that.


After some research, I found this article ( http://book.cakephp.org/view/1652/Plugin-DataSources-and-Datasource-Drivers). Basically, you can not place your driver file in the directory ( \cakephp\cake\libs\model\datasources\dbo) where the "factory" driver files are located. Instead you should place the driver file in following directory of your baked cake.

 your-cake-application\plugins\your-plugin-name\models\datasources\dbo

And then you should change your database.php in config accordingly.

 <?php
 class DATABASE_CONFIG {

    var $default = array(
    'driver' => 'your-plugin-name.DboSqlsrv',
    'host' => 'localhost\EPHP',
    'login' => 'sa',
    'password' => 'xxxxxxx',
    'database' => 'Blog',
    );
  }
  ?>

After this, I could run my cakephp app.