Skip to content

No timeouts supported in ODBC Driver XX for SQL Server? #143

@rayrapetyan

Description

@rayrapetyan

Looks like "ODBC Driver XX for SQL Server" for Linux (I've checked versions 13 and 17) doesn't support any timeout options. I've tried all possible combinations, e.g.:

"LoginTimeout"
"Login Timeout"
"Login_Timeout"
"ConnectTimeout"
"Connect Timeout"
"Connect_Timeout"
a
nd none of them are recognized by the driver.

Here is my test code:

import pyodbc as odbc
conn = odbc.connect('Driver={ODBC Driver 17 for SQL Server};Server=mymssqlserver;Database=mydatabse;LoginTimeout=3;')

I've disabled local network and it always takes ~15 seconds before it returns:

SQLState = [HYT00]
Native = 0x7ffe15aab9f0 -> 0
Message Text = [[Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired]

As per docs:
https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/odbc-driver-on-linux-support-for-high-availability-disaster-recovery
loginTimeout options should be supported, but there is no such string in a driver binary, and when specified you'll get:

DIAG [01S00] [Microsoft][ODBC Driver 17 for SQL Server]Invalid connection string attribute
in trace logs.

So, how to specify timeouts when using "ODBC Driver XX for SQL Server" for Linux?

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