tags:

views:

159

answers:

2

When I add

client charset = UTF-8

to my freetds.conf file, my DBD::Sybase program emits:

Out of memory!

and terminates. This happens when I call execute() on an SQL query statement that returns any ntext fields. I can return numeric data, datetimes, and nvarchars just fine, but whenever one of the output fields is ntext, I get this error.

All these queries work perfectly fine without the UTF-8 setting, but I do need to handle some characters that throw warnings under the default character set. (See related question.)

The error message is not formatted the same way other DBD::Sybase error messages seem to be formatted. I do get a message that a rollback() is being issued, though. (My false AutoCommit flag is being honored.) I think I read somewhere that FreeTDS uses the iconv program to convert between character sets; is it possible that this message is being emitted from iconv?

If I execute the same query with the same freetds.conf settings in tsql (FreeTDS's command-line SQL shell), I don't get the error.

I'm connecting to SQL Server.

What do I need to do to get these queries to return successfully?

+3  A: 

I saw this in .conf file - see if it helps:

# Command and connection timeouts
; timeout = 10
; connect timeout = 10
# If you get out of memory errors, it may mean that your client
# is trying to allocate a huge buffer for a TEXT field.
# (Microsoft servers sometimes pretend TEXT columns are
# 4 GB wide!) If you have this problem, try setting
# 'text size' to a more reasonable limit
text size = 64512 
DVK
That fixed it; thank you!
skiphoppy
A: 

These links seem relevant as well and show how the setting can be changed without modifying the freetds.conf file:

http://lists.ibiblio.org/pipermail/freetds/2002q1/006611.html http://www.freetds.org/faq.html#textdata

The FAQ is particularly unhelpful, not listing the actual error message.

skiphoppy