pymssql.OperationalError:DB-Lib错误消息20009,严重性9 [英] pymssql.OperationalError: DB-Lib error message 20009, severity 9

查看:438
本文介绍了pymssql.OperationalError:DB-Lib错误消息20009,严重性9的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行此程序

conn = pymssql.connect(host='localhost',  user='notsa', password='notsayly', database='TallicaTweets')

但是我收到以下错误:

Traceback (most recent call last):
  File "harvester_of_tweets.py", line 11, in <module>
    conn = pymssql.connect(host='localhost',  user='username', password='password!', database='Database')
  File "/usr/local/lib/python2.7/dist-packages/pymssql.py", line 607, in connect
    raise OperationalError, e[0]
pymssql.OperationalError: DB-Lib error message 20009, severity 9:
Unable to connect: Adaptive Server is unavailable or does not exist
Net-Lib error during Connection refused Error 111 - Connection refused

搜索Google并没有真正的帮助,那里的一些评论并没有真正详尽.我应该将凭证添加到特定的配置文件中吗?以及如何在mssql中创建凭据? (我已经在psql中完成了这些操作,但对mssql并不熟悉.

Searching Google wasn't really helpful and the few tuts out there weren't really thorough. Should I add my credential into a specific configuration file? And how to create credentials in mssql? (I have done these things in psql but not familiar with mssql.

我正在使用Ubuntu 13.04 ad,我的python版本是2.7.

I am using Ubuntu 13.04 ad my python version is 2.7.

创建用户登录名后,我收到此错误:

After I created a user login I am receiving this error:

Traceback (most recent call last):
  File "harvester_of_tweets.py", line 11, in <module>
    conn = pymssql.connect(host='localhost',  user='tweet', password='1234', database='tweet_db')
  File "/usr/local/lib/python2.7/dist-packages/pymssql.py", line 607, in connect
    raise OperationalError, e[0]
pymssql.OperationalError: DB-Lib error message 20009, severity 9:
Unable to connect: Adaptive Server is unavailable or does not exist
Net-Lib error during Connection refused Error 111 - Connection refused

推荐答案

我遇到了相同的问题.原来,我没有为本地SQL服务器打开TCP/IP访问.

I encountered the same issue. It turns out that I didn't open up TCP/IP access for my local SQL server.

进行快速测试以检查是否是由此引起的,您可以尝试使用相同的代码连接到远程服务器.如果有效,则意味着本地服务器出了点问题.

Do a quick test to check whether it's caused by this, you can try to connect to a remote server with the same code. If it works, it means something is wrong with your local server.

因此,只需在SQL Server配置管理器中打开对127.0.0.1:1433的访问即可.

So just open the access to your 127.0.0.1:1433 in the SQL server Configuration Manager.

步骤:

  1. 开始->所有程序-> Microsoft SQL Server 20XX->配置工具-> SQL Server配置管理器
  2. SQL Server网络配置-> MSSQLSERVER的协议
  3. TCP/IP->属性-> IP地址.找到127.0.0.1,然后将启用"更改为是".如果需要,您可以对所有IP执行此操作.

这篇关于pymssql.OperationalError:DB-Lib错误消息20009,严重性9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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