Hi,

I'm trying to access a second MS SQL database with cakephp 2.0.5 on
Linux.
I have setup an Sqlserver datasource in Config/database.php

public $msdb = array(
      'datasource' => 'Database/Sqlserver',
      'persistent' => false,
      'host' => 'xxx.xxx.xxx.xxx',
      'port' => '1433',
      'login' => 'username',
      'password' => 'password',
      'database' => 'DB',
      'prefix' => '',
);

However I get this error:
Missing Database Connection
Error: Sqlserver requires a database connection

Error: Confirm you have created the file : app/Config/database.php.

Notice: If you want to customize this error message, create app/View/
Errors/missing_connection.ctp.

Stack Trace

#0 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Model/
ConnectionManager.php(101): DboSource->__construct(Array)
#1 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Model/
Model.php(3234): ConnectionManager::getDataSource('msdb')
#2 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Model/
Model.php(1030): Model->setDataSource('msdb')
#3 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Model/
Model.php(3258): Model->setSource('PERSON')
#4 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Model/
Model.php(2483): Model->getDataSource()
#5 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Controller/
Component/PaginatorComponent.php(172): Model->find('all', Array)
#6 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Controller/
Controller.php(1025): PaginatorComponent->paginate(NULL, Array, Array)
#7 /var/www/html/modip/app/Controller/PersonsController.php(7):
Controller->paginate()
#8 [internal function]: PersonsController->index()
#9 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Controller/
Controller.php(473): ReflectionMethod-
>invokeArgs(Object(PersonsController), Array)
#10 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Routing/
Dispatcher.php(104): Controller->invokeAction(Object(CakeRequest))
#11 /var/www/html/modip/cakephp-cakephp-6864406/lib/Cake/Routing/
Dispatcher.php(86): Dispatcher->_invoke(Object(PersonsController),
Object(CakeRequest), Object(CakeResponse))
#12 /var/www/html/modip/app/webroot/index.php(96): Dispatcher-
>dispatch(Object(CakeRequest), Object(CakeResponse))
#13 {main}

Outside of cakephp I can access it without any problem using
mssql_connect("ip_addr:1433", $user, $pass);

Is there something more I should do?
I've debuged it a bit more and see that it fails in
lib/Cake/Model/Datasource/Database/Sqlserver.php in
public function enabled() {
      return in_array('sqlsrv', PDO::getAvailableDrivers());
   }
There is no sqlsrv in PDO drivers. If I understand correctly from
varius documents,
sqlsrv is for Windows.

How can I use it for linux?

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to