Skip to content

How timeouts work, and how different timeouts (Connection/Login/Query) interact is not clear #137

@matthew-wozniczka

Description

@matthew-wozniczka

SQL_ATTR_CONNECTION_TIMEOUT has the following description (on https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlsetconnectattr-function?view=sql-server-2017)

An SQLUINTEGER value corresponding to the number of seconds to wait for any request on the connection to complete before returning to the application. The driver should return SQLSTATE HYT00 (Timeout expired) anytime that it is possible to time out in a situation not associated with query execution or login.

From this, I had assumed that 'request on the connection' referred to any ODBC API function called on the connection handle (or one of it's child statements or descriptors), since it followed with 'before returning to the application'), but then I realized it was strange that many ODBC functions were documented to return, for example, both HYT00 and HYT01.

Is this a documentation error? Or does it use the minimum of the timeouts, and use that?

Also, the documentation for SQL_ATTR_QUERY_TIMEOUT (on https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlsetstmtattr-function?view=sql-server-2017 ) says

An SQLULEN value corresponding to the number of seconds to wait for an SQL statement to execute before returning to the application. If ValuePtr is equal to 0 (default), there is no timeout.

But it never really defines what counts as a SQL statement executing. I had thought it referred to SQLExecute & SQLExecDirect (and probably also SQLPrepare), but it shows up on a lot of other functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions