Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 1.9
-
Fix Version/s: None
-
Component/s: Authentication
-
Labels:None
-
Environment:Linux
-
Database:Microsoft SQL
-
Affected Branches:MOODLE_19_STABLE
Description
I need to do the authentication using SQL server DB, when I tried that I get this error:
4004: Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier.
I solved this problem by casting the required field (username & password) to text in lib/adodb/adodb.inc.php , for example:
.... CAST(username AS TEXT) username, ...
and it is working good now ... but I prefer to do it from front end instead of hard codded.
Thanx alot.
Hi Danya,
and what driver are you using to connect to the MSSQL server? The "standard" mssql one (from Moodle) with the "standard" mssql one (from PHP) ? And what PHP version?
The main problem is that the "standard" PHP driver is based in really old libraries (not supporting UTF-8 at all). And, since 1.6 release, Moodle is 100% UTF-8, so, in order to connect to the server, you have two options:
1) Real pure UTF-8 communication: Install FreeTDS or ODBTP (in the same way that the needed one to run Moodle against MSSQL) and then, use the mssql_n driver for your external authentication. Complex but should work for any character.
2) Converted to Windows-1252 communications. You can, simply, set the "extencoding" setting to "windows-1252". That way, all the communications between Moodle will be converted from/to utf-8 to/from Windows-1252. Simpler, but will break for any user having non Windows-1252 characters.
Ciao