We have been trying for hours getting a second datasource to work which 
connects to a MS Sql Server (2008) from linux.
On windows we have running the "pdo_sqlserv" extension. And with a few 
hours of trial and error and installation of different drivers we got it up 
and running.
We use the following datasource:

public $mssql = array(
'datasource' => 'Database/Sqlserver',
'host' => '192.168.0.2\SQLEXPRESS',
'login' => 'user',
'password' => 'pwd',
'database' => 'table',
);

On linux, though, we cannot get pdo_sqlserv to run (confirmed with 
phpinfo). Only mssql (for plain mssql where is no datasource for) or 
pdo_dblib.
The latter is supposed to be the eqivalent to the windows pdo_sqlserv but 
the datasource always errors with `datasource could not be created`.

What does work, though, is using this manuel statement:

            $dsn = 'dblib:dbname=database;host=192.168.0.2\sqlexpress';
            $user = 'user';
            $password = 'pwd';

            $dbh = new PDO($dsn, $user, $password);

            $stmt = $dbh->prepare("SELECT * FROM tablename");
            $stmt->execute();
            while ($row = $stmt->fetch()) {
                ...
            }

So the connection details seem to be right and the connection is 
establishable. 
Only the extension/module which our Sqlserver datasource is expeting is not 
really working.
We have to use this manual snippet which, of course, is incompatible to the 
rest of the model code (which uses the datasource for find(first) and 
find(all) queries).

note: that we replaced "sqlserv:" with "dblib:" here in order to get it to 
work.
So is there some special dblib datasource here for linux? Or what's going 
on?
thx

-- 
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