[freetds] 20047: DBPROCESS is dead or not enabled

LacaK lacak at zoznam.sk
Mon Sep 19 08:44:32 EDT 2016


I am using FreeTDS dblib as client library which connect to SQL Server 2012.
I am using application which runs in background and sometimes queries 
SQL Server.

But when computer where application runs comes into sleep mode, after 
wakeup next query fails with above mentioned error.

It is expected, because SQL Server sends keep alive packet and client 
does not respond, so SQL Server resets connection.

My question is if there is an elegant way how to handle this situation ?
How to detect dead dbprocess (there is dbdead(), but I can use this 
function only after failed query; I can not check status of connection 
before I send query?) ?

Or only way is catch exception, check if it is error 20047 and if yes, 
then connect again and send query again ?



More information about the FreeTDS mailing list