quite tricky... after few more hours I got it to run :)
it only works if "port" is manually set to NULL (omitting it in the
database file won't do it).
but with this datasource we seem to have encoding problems, though
[address] => ������� 21 �.�����
there are greek utf8 letters etc. with the sqlserver datasource from cake
(on windows) they are displayed correctly.
with yours and linux the above happens.
seems like the tables are in "Latin1_General_CI_AS" and should probably be
converted. what if that isn't possible because it is a foreign DB?
can we convert it back to utf8? because I dont see any "encoding"
properties in the datasource itself.
i wonder why it works with the pdo sqlserv datasource on windows
probably because in the PDO version you can set the encoding somehow
if (!empty($config['encoding'])) {
$flags[PDO::SQLSRV_ATTR_ENCODING] = $config['encoding'];
}
thank you
Am Mittwoch, 11. April 2012 21:29:24 UTC+2 schrieb euromark:
>
> 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