python程序连接sqlserver报错,连接失败,解决方法

上一篇 / 下一篇  2018-10-09 11:36:06

1.python程序连接sql server报错,连接失败
Traceback (most recent call last):
  File "pymssql.pyx", line 635, in pymssql.connect (pymssql.c:10734)
  File "_mssql.pyx", line 1902, in _mssql.connect (_mssql.c:21821)
  File "_mssql.pyx", line 637, in _mssql.MSSQLConnection.__init__ (_mssql.c:6581)
  File "_mssql.pyx", line 1630, in _mssql.maybe_raise_MSSQLDatabaseException (_mssql.c:17524)
_mssql.MSSQLDatabaseException: (20009, b'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist (L17705\\SQLEXPRESS)\n')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "F:/1/picture1.py", line 17, in <module>
    conn=pymssql.connect(server,user,password,"test")
  File "pymssql.pyx", line 641, in pymssql.connect (pymssql.c:10824)
pymssql.OperationalError: (20009, b'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist (L17705\\SQLEXPRESS)\n')
2.由于对程序未进行任何改动,执行程序报错,由于前几天PC机器重启过。故
查看服务-sql server相关服务,发现sql server browser服务未启动(手动)。
3.手动启动后,并将服务设置为自动启动。执行程序,运行正常

TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

Open Toolbar