Why can I connect to Azure MS SQL with tsql but not pymssql?

自闭症网瘾萝莉.ら 提交于 2019-12-06 09:47:44

It looks like Gord was right: The problem was that pymssql wheel does not have SSL bindings.

I uninstalled it:

python -m pip uninstall pymssql

Then installed it from source:

python -m pip install --no-binary pymssql pymssql

This required me to install a few dependencies. But now I can connect with

pymssql.connect('example.database.windows.net',
                user='me', 
                password='notreallymypassword', 
                database='ExampleDB',
                tds_version='7.2')

Your connection string doesn't look right. It should be something like:

pymssql.connect(server='example.database.windows.net', user='me@example', password='notreallymypassword', database='ExampleDB')

Note that in your example call to connect(), you are missing a server= parameter; you only had the full server name.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!