[freetds] FreeTDS hangs when running a select

Brian Johnson serversage at gmail.com
Mon Apr 7 03:07:37 EDT 2008

I have NO idea what to call this, thus the vague subject line.  We are
connecting to an MS SQL server using Perl, dbi:ODBC, and FreeTDS.  The
problem also exists when connecting using sqsh -S WHATEVER -U USER -P PASS.

Let me start by saying that the following numbers are somewhat made up, but
demonstrate the problem accurately.  Anyway, lets say we have a table with 5
columns, and 100 rows.  If we do a "select * from foo", we would expect to
get 100 rows returned.  We don't.  Instead we get say 25 rows, and the
select hangs.  I can print out the results of those 25 rows in perl, but the
26th row never gets returned.

So, we modified the select to be "SELECT col1 FROM foo", and we got all 100
rows of that column.  So we did "SELECT col1, col2 FROM foo", and then we
got 75 rows and it hung.  So we tried "SELECT col1, col2, col3" FROM foo",
and ended up getting 50 rows.

Of course, the numbers were not so nice and round.  As for how we are
connecting, I have tried DSN and DNS-less connections with dbi::ODBC, and of
course have tried with sqsh.  For sqsh I added an entry to freetds.conf, and
then ran sqsh -S ENTRYNAME -U USER -P PASS.  I was able to do very small
selects, but any time I did a select that returned large numbers of rows it

For the ODBC connections, we have unixodbc on the backend.  This is on a
Debian box, running FreeTDS 0.63-3.2, unixodbc 2.2.11-13, and sqsh 2.1-8.  I
also saw the same behavior on a Gentoo system running FreeTDS 0.64 and sqsh

I will admit, I'm a bit green in this department.  But this is all working
for another MS SQL server running an older version of MS SQL (2000 I
believe).  And I think the new server is running 2003.  I will find out for
sure tomorrow (Monday).

Any help, pointers, or direction would be GREATLY appreciated.  If more
information is needed, I can happily provide it.  Thanks in advance!


More information about the FreeTDS mailing list