Hello, I'm in a bit of a state and I'm hoping that someone can help me out.
I've been racking my brain for the last two days trying to do something which I
thought would be pretty simple. Getting the perl DBI to talk to a remote MS SQL
Server. Well, it turns out that it is fairly easy to do this. I have implemented the
FreeTDS module and the Sybase module for DBD and both are working nicely. EXCEPT for
one huge issue that is making all of the work I've done pretty close to useless for my
situation. I get a nasty "out of memory" error whenever I try to select a "text" field
from the MS SQL Server. This error is reported from my OS (Linux) not the DBI from
what I can tell.
>From what I can gather, the text type in SQL Server has a possible 2 gig limit for
>it's data size. It appears that the DBI tries to allocate this much memory for the
>fetch and craps out the script. Is this true?
I've tried $dbh->LongReadLn and that didn't seem to fix it. Also, I am using up to
date versions of DBD::Sybase ,FreeTDS and DBI.
Other data can be accessed just fine, it seems to only happen with the text field (or
ntext, not sure whjat the real name is, but DBVisualizer seems to thnk it;s just plain
"text" :)
Any help would be MORE than helpful, and I'll buy you a virtual beer!
Here are a couple sample pieces of code and responses. Perhaps someone can see a major
bug that I do not:
# All sensitive vars defined somewhere else :)
$dsn = "DBI:FreeTDS:database=$DBASE;host=$DBHOST;port=$PORT";
$dbh = DBI->connect($dsn, $user, $password);
$req = q{SELECT LongDesc FROM Bid WHERE ID = 132261} ;
$id = $dbh->selectrow_array($req) ;
print "Info: $id \n " ;
$dbh->disconnect ;
exit ;
This script produces the following error:
perl: tdslayer.c:238: AllocMemory_real: Assertion `(long)size>0' failed.
Aborted (core dumped)
Thanks,
Aaron McNeal
Wigsy