您好,请问你的python连接数据库的问题是怎么解决的?
Traceback(mostrecentcalllast):File"D:/Python27/goon.py",line2,in<module>conn=pymssql....
Traceback (most recent call last):
File "D:/Python27/goon.py", line 2, in <module>
conn=pymssql.connect(host=".",user="sa",password="123456",database="xuxy")
File "pymssql.pyx", line 636, in pymssql.connect (pymssql.c:10178)
OperationalError: (20009, 'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist\nNet-Lib error during Unknown error (10035)\n') 展开
File "D:/Python27/goon.py", line 2, in <module>
conn=pymssql.connect(host=".",user="sa",password="123456",database="xuxy")
File "pymssql.pyx", line 636, in pymssql.connect (pymssql.c:10178)
OperationalError: (20009, 'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist\nNet-Lib error during Unknown error (10035)\n') 展开
展开全部
mssql 是不是可以考虑直接用 os.popen,pymssql并不是很好用,老是会有大大小小的问题
def dbtest(dbpasswd):
#检查数据库是否可以登录
cmd="osql -U netcafe -P "+dbpasswd+" -Q "+"\""+\
""+"\""
popenstr=os.popen(cmd)
popenstrreadlines=popenstr.readlines()
if len(popenstrreadlines)==0:return 1
return popenstrreadlines
看一下这个,很久前写的
网页链接
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询