Re: Sybase disconnect after idle

Michael Peppler <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On Feb 22, 2012, at 11:32 PM, Michelle Dupuis wrote:

> I have a C program using freetds ver 0.91 (package on CentOS 5.7).  All seems to work well, but after some idle time (eg: 5 hours) the connection seems to drop because attempts to issue a query result in error 20003 (disconnect).  Is freetds disconnecting or is the Sybase server disconnecting the session?
> Is there any way to prevent this?

Normally, Sybase will not disconnect an idle session. However, there are ways to enable this (e.g. checking on various MDA tables, and killing idle connections), so you check with your DBA that this is not in place on the database side.
I'm not 100% up to date on the FreeTDS internals, but I don't think that it has any idle disconnect logic (I know for a fact that Sybase OpenClient does not).
Another possibility is that there is a router or firewall between your program and the Sybase server, and it does idle disconnect - this is something that is fairly common - so maybe check with your network admins.

If I remember correctly I think that Sybase OpenClient has an option to turn on a keep-alive probe - I don't know if FreeTDS has included anything similar. Enabling this should at least fool the network layer into thinking that there is activity and avoid any disconnects from routers/firewalls.

Michael
--
Michael Peppler
Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html

"A successful [software] tool is one that was used to do something undreamed of by its author." -- S. C. Johnson
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.