Skip to Content.
Sympa Menu

freetds - Re: [freetds] Setting ODBC timeouts

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Setting ODBC timeouts
  • Date: Mon, 18 Aug 2008 20:58:25 -0400

Chris Reeves wrote:
> I set the SQL_ATTR_LOGIN_TIMEOUT and SQL_ATTR_CONNECTION_TIMEOUT
> attributes using SQLSetConnectAttr and later calls to SQLGetConnectAttr
> suggest that these attributes have indeed been changed. Despite this, no
> matter what I set these two attributes to, the login always takes 40
> seconds to time out and the connection timeout appears to be 'infinite'.
> The timeouts in /etc/freetds/freetds.conf are both set to 1. The code
> I'm using runs along the following lines (but with additional error
> checking included - all calls return SQL_SUCCESS).

It works that way because that's the way the code was written. :-/

ODBC distinguishes between timeouts for connecting and logging in. db-lib
does not, and the underlying function, tds_connect() appears not to,
either. You are able to set and get SQL_ATTR_LOGIN_TIMEOUT and
SQL_ATTR_CONNECTION_TIMEOUT, but they're not used by tds_connect().

I identified this area as something that needs to be addressed a little
while back. Basically, we need one function that connects and one that
logs in, and each one can use its own timer. I haven't had time to work
on it. Patches welcome.

Once the support functions are in place, wiring the ODBC layer to them
will be signficantly easier.

--jkl





Archive powered by MHonArc 2.6.24.

Top of Page