[freetds] Using FreeTDS 0.95 INSERTS fail above 66000 characters...unless 'dump file' is turned on

Jacopille, David DJacopille at MFS.com
Mon Oct 5 17:07:02 EDT 2015

Looking for suggestions or a troubleshooting approach on this 100%
reproducible issue where FreeTDS logging seems to be the only variable.

Since the issue goes away as soon as I turn on freetds logging I can¹t
look at the logs to find the problem.

        SQL Server 2012
        OS X 10.9.5
        FreeTDS 0.95.20
        DBD::Sybase 1.15
        TDSVER 7.0  or 7.1 (same symptoms)
        Perl 5.16.3
        FreeTDS text size = 1000000

Testing large string INSERTS to a table with a single, nvarchar(max),

A. With freetds logging on (via 'dump file = /tmp/freetds.log¹) INSERT
values from 0-500,000 characters are successful.  Decreasing reliability
above 500,000 characters.

B. INSERT statements with values of 0 thru 66,000 characters always work,
regardless of freetds logging on/off

C. SELECT work correctly for all values 0 thru one million characters,
regardless of freetds logging on/off

If freetds logging is turned off the following fails consistently:

A. 67,000 character INSERT              stalls at INSERT

B. 100,000+ character INSERT            doesn¹t stall but doesn¹t INSERT

C. Stored Procedures also experiencing failures in same character ranges


# In the failure configuration it looks like this.
# The ³DOES NOT WORK² symptoms go away if the last two lines are

        client charset = UTF-8
        text size = 1000000

        host = bossqld4.mfs.com
        port = 1433
        tds version = 7.0
        #dump file = /tmp/freetds.log
        #dump file append = no


use DBI qw(:sql_types);
use DBD::Sybase;
my ($sql, $dbh, $ref, $largetext);

$dbh = DBI->connect( 'DBI:Sybase:server=bossqld4', ŒCORP\user',
Œpassword', { PrintError => 0 } ) or die;
$dbh->do('use testdatabase');

$largetext = 'x' x 100000; # one hundred thousand characters

$dbh->do(qq|INSERT into TESTTABLE (maxtext) values (N\'$largetext\')|);

# SELECT not affected by FreeTDS logging on/off
# SELECT always successful on all values tested up to one million
characters (and probably much larger, but untested).

$sql = q|SELECT TOP 1 [maxtext] FROM TESTTABLE|;
$ref = $dbh->selectrow_arrayref($sql);
print 'Length of value: '. (length $$ref[0]) ."\n";


Thank you,
Dave Jacopille

MFS Email system made the following annotation
This email communication and any attachments may contain proprietary, confidential, or privileged information. If you are not the intended recipient, you are hereby notified that you have received this email in error and that any review, disclosure, dissemination, distribution or copying of it or its contents is prohibited. The sender does not waive confidentiality or any privilege by mistransmission. If you have received this email in error, please notify the sender immediately, delete this email, and destroy all copies and any attachments.

More information about the FreeTDS mailing list