Home > Archive > MS SQL Server ODBC > October 2006 > SQLFetch behaviour when SQL Server offline









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SQLFetch behaviour when SQL Server offline
Minh

2006-10-28, 7:15 pm

Hi everyone,

In debugging a problem we have when the SQL Server goes offline, I found
that the behaviour of SQLFetch is not what I expected.

I have code which calls SQLExecDirect and then followed by SQLFetch. Now to
simulate the problem I run my application in debug mode and run past the
SQLExecDirect call but breaking at the SQLFetch call.

For the query that I'm running, it should return about 800 rows. When I
reach the breakpoint (at SQLFetch), I stop the SQL Server service -
effectively simulating a disconnection. When I trace through my SQLFetch
loop, I find that it returns about 16 rows before returning SQL_NO_DATA. I
would have imagined the first call would have returned SQL_ERROR. Even if SQL
Server did buffer some of its return data, I would have thought after the
16th row it would return SQL_ERROR rather than the misleading SQL_NO_DATA. Am
I right to expect this or is there a better way to detect disconnections?

Any help or insights much appreciated!
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com