[freetds] php ntext/nvarchar problems

Lorenz, Marcus Marcus.Lorenz at unilever.com
Tue Jun 2 12:17:14 EDT 2009

Hello everybody,
i'm probably the millionth person who has problems fetching ntext fields
from an mssql 2005 server db.
I have read (nearly) all posts i could find regarding problems with the
protocol if have to use (8.0) and the set textsize options.
But i'm still unable to retrieve any data from such fields. They are
only empty. All other data is retrieved fine.
I have set text size within the freetds.conf to 65535 (see below). 
These are my php commands on top of anything else:
Within the phpinfo() these values are used as local value for their
specific keys.
Directly after establishing a connection to the server i execute
set textlimit 65535.
Before executing the statement that uses the ntext-field i have check
the size with:

select @@TEXTSIZE as 'abc' and abc turns out to be 65535
Here is my freetds.conf (a part of it):
        tds version     = 8.0
        host            = XXXX
        port            = 10464
        text size       = 65535
        client charset  = UTF-8
And the odbc.ini:
Driver          = /usr/lib/libtdsodbc.so.0
Description     = v0.64 with protocol v8.0
Trace           = No
Servername      = TransactionHub_freeTDS
Database        = XXXX
UID             = XXXX
Driver          = /usr/lib/libtdsodbc.so.0
Within the trace i can see my query and the data of the field:
|..P.R.O. C.E.D.U.|
|R.E.1._. S.T.A.R.|
|T. .
Well this is just a part of it. If needed i can attach the whole part.
The only thing that is left is the freetds version which is 0.64 from
the rpm. I haven't found a hint that this problem is related to this
Unlikely i have to ask our IT to compile this and this is always a
little bit tricky. ;)
So any help would be great, even if its a "look here"...

More information about the FreeTDS mailing list