Skip to Content.
Sympa Menu

freetds - Re: [freetds] Setting for returned column size in FreeTDS?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Setting for returned column size in FreeTDS?
  • Date: Fri, 18 Aug 2006 10:03:56 +0200

>
> On Aug 18, 2006, at 1:03 AM, Frediano Ziglio wrote:
>
> > Il giorno gio, 17/08/2006 alle 18.11 -0400, Ken Tozier ha scritto:
> >> Well I checked into this today and although I wasn't able to solve
> >> the 255 character limit, I did discover that it only exists when
> >> retrieving data from MSSQL. I can write large strings
> without problem
> >> (Verified by looking at the database with Query Analyzer)
> >>
> >> I don't know whether this is a FreeTDS issue or a MSSQL
> one but if it
> >> sounds like a FreeTDS issue, what other steps would you recommend?
> >>
> >> The actual usage scenario goes like this
> >> 1. Mac OS X application sends a request to a PHP script.
> >> 2. PHP script packages up the request into an SQL query
> and sends it
> >> off to MSSQL
> >> 3a. If the request was an insert, it completes successfully
> >> regardless of data length
> >> 3b. If the request is a select, I get back the full contents of
> >> fields shorter than 255 characters but all fields 256 characters or
> >> longer get truncated to 255
> >>
> >> Of note is that all queries, both insert and select, work
> as expected
> >> with MySQL so it's not a problem with the SQL (I do make the
> >> necessary query syntax changes for MSSQL)
> >>
> >> Thanks
> >>
> >> Ken
> >>
> >
> > As said is a configuration problem. Try with this line
> >
> > putenv('TDSVER=7.0');
> >
> > before PHP connection. You are using an old protocol that do no
> > support
> > more than 255 characters on strings. You are able to insert
> more than
> > 255 cause sql statements sent to server have not this limit.
> >
> > freddy77
>
> Thanks Freddy
>
> I already set all copies on freetds.conf on our server to use
>
> # A typical Microsoft SQL Server 2000 configuration
> [MyServer2k]
> host = <correct domain here>
> port = 1433
> tds version = 8.0
>
> But it didn't work still getting 255 char truncation. I want
> to avoid
> environment variables as they are extremely confusing and hard to
> find for non unix folks and the maintainers for this project have
> even less unix experience than I do.
>
> Unless I'm missing something, setting tds version = 8.0 should have
> fixed the problem but the fact that it didn't means there is some
> other hidden variable somewhere, perhaps not even in freetds that is
> causing the truncation.
>
> Ken
>


I know environments variables seem ugly but for a test are quite useful.
Most of the times php script are executed on a web server (Apache I
imagine) and many time these scripts fails to find freetds.conf cause
web server use chroot or simply cause Apache use another user. FreeTDS
use some environment to help solve the problem (some like TDSVER to
force a settings, others like TDSDUMP/TDSCONFIGDUMP create dumps that
tells what FreeTDS is doing). I suggest you to try environments and when
you discover the problem remove them. If TDSVER works (as I expect) I
would try to use TDSDUMPCONFIG=stdout to see how FreeTDS read
configuration.

Frediano





Archive powered by MHonArc 2.6.24.

Top of Page