Skip to Content.
Sympa Menu

freetds - Re: [freetds] FreeTDS and Ubuntu, iodbc

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: mohnd AT egolfscore.com, FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] FreeTDS and Ubuntu, iodbc
  • Date: Thu, 19 Apr 2007 22:53:12 -0400

Dan Mohn wrote:
> So I ran my first test with bsqlodbc;
>
> $ /usr/local/freetds/bin/bsqlodbc -S
> eGolfScoreProd -U <XX> -P <XX> -i timeouttest_bodbc.sql
> Name
> rowstat
...
> AWL - Centerton Event
> 1
> "[FreeTDS][SQL Server]%READY TO FETCH NEXT%"
> "[FreeTDS][SQL Server]%Orlando Show Event%"
> "[FreeTDS][SQL Server]%READY TO FETCH NEXT%"
> "[FreeTDS][SQL Server]%International Event%"
> "[FreeTDS][SQL Server]Waiting 30 seconds for timeout."
> "[FreeTDS][SQL Server]%READY TO FETCH NEXT%"
> "[FreeTDS][SQL Server]%Rogers Presidents Golf Classic%"
> "[FreeTDS][SQL Server]Waiting 30 seconds for timeout."
> "[FreeTDS][SQL Server]%READY TO FETCH NEXT%"
> "[FreeTDS][SQL Server]%Augusta Hooters Store Tournament%"
> "[FreeTDS][SQL Server]%READY TO CLOSE%"
> "[FreeTDS][SQL Server]%READY TO DEALLOCATE%"
> "[FreeTDS][SQL Server]%DONE%"
>
> timeouttest_bodbc.sql is ;
>
> ----------begin timeouttest_bodbc.sql
> DECLARE @Count int
> declare @NamePrint nvarchar(255)
> SET @Count = 0
>
> DECLARE c1 cursor
> FOR
> SELECT Name
> from eGolfOutings.dbo.Outing
>
> OPEN c1
> FETCH NEXT FROM c1
>
> WHILE @@fetch_status = 0 AND @Count < 4
> BEGIN
> SET @Count = @Count + 1
> IF @Count > 2
> BEGIN
> PRINT 'Waiting 30 seconds for timeout.'
> WAITFOR DELAY '00:00:30'
> END
> PRINT '%READY TO FETCH NEXT%'
> FETCH NEXT FROM c1 into @NamePrint
> PRINT '%' + @NamePrint + '%'
>
> END
>
> PRINT '%READY TO CLOSE%'
> CLOSE c1
>
> PRINT '%READY TO DEALLOCATE%'
> DEALLOCATE c1
>
> PRINT '%DONE%'
> ------------end timeouttest_bodbc.sql
>
> Since the timeouts was set to 10, I would expect a timeout to have
> occurred at the WAITFOR. But it continues on ok.

Dan,

That's quite clear. Thanks very much.

I tried a similar test without yanking any cables. I set timeout = 10 in
freetds.conf and tried bsqldb and bsqlodbc:

$ cat sql/timeout.sql
print 'hello'
select 1 as one
WAITFOR DELAY '00:00:30'
print 'goodbye'
select 2 as two

$ time bsqldb -S timeout -U asdf -P asdf -i sql/timeout.sql
bsqldb: Msg 20003, Level 6
Adaptive Server connection timed out

bsqldb:193: dbsqlok() failed

real 0m10.924 <== expected, timeout is 10 seconds
user 0m0.000s
sys 0m0.006s

$ time bsqlodbc -S timeout -U asdf -P asdf -i sql/timeout.sql
"[FreeTDS][SQL Server]hello"
one
----------
1
"[FreeTDS][SQL Server]goodbye"
two
----------
2

real 0m32.116s <== not good, equal to WAITFOR
user 0m0.007s
sys 0m0.000s

What's happening? I don't know how, but I know what: somehow,
tds->query_timeout is getting set to zero in the ODBC layer. The timeout
logic never gets called; tdserror() doesn't appear in the TDSDUMP log.
I'm using the latest:

$ ldd $(which bsqlodbc) | grep tdsodbc
-ltdsodbc.0 => /usr/local/lib/libtdsodbc.so.0

$ ident /usr/local/lib/libtdsodbc.so.0.0 | head -4
/usr/local/lib/libtdsodbc.so.0.0:
$Id: odbc.c,v 1.437 2007/04/18 14:29:24 freddy77 Exp $
$Id: connectparams.c,v 1.71 2007/04/11 11:53:10 freddy77 Exp $
$Id: convert_tds2sql.c,v 1.48 2006/06/14 15:34:44 freddy77 Exp $

Frediano mentioned that timeout testing is on his TODO list for the next
release. Let's see what he says.

Regards,

--jkl





Archive powered by MHonArc 2.6.24.

Top of Page