Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pypyodbc.connection_timeout dont work #96

Open
fetidbell opened this issue Apr 23, 2019 · 0 comments
Open

pypyodbc.connection_timeout dont work #96

fetidbell opened this issue Apr 23, 2019 · 0 comments

Comments

@fetidbell
Copy link

import pypyodbc
pypyodbc.connection_timeout = 10

serverName = 'server'
database = 'DB'
username = 'user'
password = 'pass'

try:
    conn = pypyodbc.connect('DRIVER={ODBC Driver 13 for SQL Server};SERVER='+serverName+';DATABASE='+database+';UID='+username+';PWD='+password)
except pypyodbc.Error as ex:
    print(ex, serverName, database)

Hi everyone!

I'm trying to connect to Microsoft SQLServer 2012 with timeout, but it doesn't work: pypyodbc.connect lasts for 36 seconds (not 10 as i want) and then i get exception

('08001', '[08001] [Microsoft][ODBC Driver 13 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53]. ')

I can't understand why's that. I've tried to set timeout in connection string like that, but it doesn't work too:

conn = pypyodbc.connect('DRIVER={ODBC Driver 13 for SQL Server};SERVER='+serverName+';DATABASE='+database+';UID='+username+';PWD='+password+';Connection Timeout=10')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant