Re: Setting ODBC timeouts

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
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
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.