[freetds] MS-SQL ntext fields?
rich at experienceplus.com
Tue Jan 2 14:22:50 EST 2007
After building a new web server and pulling my content over from its
predecessor, I'm having a strange problem with some of my PHP scripts.
I'm not certain it's a freetds bug, but I have a hunch that it is.
Here's what's happening:
* PHP scripts containing certain queries are segfaulting unless I
comment out the odbc_result() calls to certain fields in the query
* The fields only break the queries if they are non-null - querying
records with null values in those fields works fine
* The fields in question don't have much in common. Some are varchar,
some are text...
* If I run the same query through isql without involving PHP or the web
server, it runs fine! BUT...
* If I try it in tsql, it fails with this message:
Msg 4004, Level 16, State 1, Server VOYAGER, Line 1
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.
* Tsql runs the queries fine if I remove all references to ntext fields.
* The ntext fields that tsql objects to are NOT the fields that I find
are breaking in the PHP scripts.
Here are the specs of my server:
2GB RAM (over 1GB shows free at the moment)
CentOS 4.4 for x86-64
freetds 0.64 built from source, configured with manual reference to the
location of unixODBC
unixODBC 2.2.11 built from source
Apache 2.0.52-28 ent.centos4
And I'm connecting to MS-SQL 2000 on a Windows SBS 2003 box.
Here's the relevant section of odbc.ini:
DRIVER = /usr/lib/libtdsodbc.so
DESCRIPTION = SQL Server 2000 on Voyager
TRACE = no
SERVER = voyager.experienceplus.com
APP = FreeTDS/unixODBC on WWW2
UID = xxxxx
DATABASE = XPlus
PORT = 1433
TDS_VERSION = 8.0
And here's the relevant stuff from freetds.conf:
tds version = 4.2
; initial block size = 512
; swap broken dates = no
; swap broken money = no
; dump file = /tmp/freetds.log
; debug flags = 0xffff
; timeout = 10
; connect timeout = 10
text size = 64512
host = voyager.experienceplus.com
port = 1433
tds version = 8.0
Anyone who has insight into this problem will earn my gratitude and a
virtual pat on the back. Thanks,
(and by the way, are the semicolons in freetds.conf comment characters?)
--Rich Young, IT Dept.
ExperiencePlus! Specialty Tours, Inc.
rich at ExperiencePlus.com
More information about the FreeTDS