In our web application, we use PHP5.2.6 + PDO to connect to the SQL Server 2005 database and store Russian texts.
Database mapping Cyrillic_General_CI_AS, table sorting Cyrillic_General_CI_AS, column type NVARCHAR(MAX).
We tried to connect to the database using the following two schemes causing different problems.
PDO mssql:
$dbh = new PDO ('mssql:host='.$mssql_server.';dbname='.$mssql_db, $mssql_login, $mssql_pwd);
in this case, the result of a simple query:
SELECT field1 FROM tbl1 WHERE id=1
shows field1data truncated to 255 bytes.
PDO odbc:
$dbh = new PDO ('odbc:DSN=myDSN;UID='.$mssql_login.';PWD='.$mssql_pwd);
and in this case, the result of the same query shows complete, not truncated data, but with question marks instead of Russian characters.
Notes:
- In SQL Management Studio, data is not truncated, and Russian characters are also displayed correctly.
- We have Windows 2003 Enterprise Edition SP2
, ?