pyodbc.OperationalError:('HYT00',u'[HYT00] [unixODBC] [Microsoft] [SQL Server的ODBC驱动程序13]登录超时已过期(0)(SQLDriverConnect)') [英] pyodbc.OperationalError: ('HYT00', u'[HYT00] [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')

查看:548
本文介绍了pyodbc.OperationalError:('HYT00',u'[HYT00] [unixODBC] [Microsoft] [SQL Server的ODBC驱动程序13]登录超时已过期(0)(SQLDriverConnect)')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用SQL Server Management Studio(SSMS)Express,我可以找到数据库并且可以毫无问题地进行连接.

Using the SQL Server Management Studio (SSMS) Express, I can find the database and connect without problems.

但是当我使用pyodbc通过以下方式连接到同一服务器时:

But when I use pyodbc to connect to the same server using:

    import pyodbc
    Server = r"xxxER\xxxSQLSERV"
    db = "xxxDB"
    user = "xxx"
    password = "xxxx"
    conn = pyodbc.connect('DRIVER={SQL Server};SERVER='+server + ';DATABASE=' + db +';UID=' + user + ';PWD=' + password)

通过在本地使用Pyhton,我可以进行连接,但是当我在linux服务器中尝试获得低于错误的值时

By Using Pyhton in my local i am able to connect but when i am trying in linux server getting below error

pyodbc.OperationalError: ('HYT00', u'[HYT00] [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')

我也尝试使用ODBC Driver 17 for SQL Server,但是也遇到了同样的问题.任何人都可以在这方面给我建议.

i tried with ODBC Driver 17 for SQL Server too but facing the same issue.Can any one please suggest me on this.

推荐答案

我遇到了这个问题,并在在这里解决了我的问题>.只需添加版本即可.

I have this problem and solved my problem in here. Just add version.

conn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server + ';DATABASE=' + db +';UID=' + user + ';PWD=' + password)

如果不起作用,则将版本17更改为13,否则请更改为11.

If not work change version 17 to 13 if not to 11 . List versions of ODBC.

这篇关于pyodbc.OperationalError:('HYT00',u'[HYT00] [unixODBC] [Microsoft] [SQL Server的ODBC驱动程序13]登录超时已过期(0)(SQLDriverConnect)')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆