[freetds] 20047: DBPROCESS is dead or not enabled

John Kendall john at capps.com
Mon Sep 19 12:00:44 EDT 2016


> On Sep 19, 2016, at 5:44 AM, LacaK <lacak at zoznam.sk> wrote:
> 
> Hi,
> 
> 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 ?

This is what I did.  Although it seemed like a distasteful solution initially, once implemented it worked so well, I got over it.  :)

> Thanks
> 
> -Laco.
> 
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds



More information about the FreeTDS mailing list