Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PYmssql python connection string

Tags:

python

pymssql

I have downloaded Pymssql to connect to the sqlserver db but the connection string is throwing error-pymssql.connect(pymssql.c.:7990)

import pymssql
pymssql.connect(host='username\SQLEXPRESS',user='username',password='pwd',database='master')

Anyone had luck connecting to the sqlserver?

Error:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pymssql.pyx", line 556, in pymssql.connect (pymssql.c:7990)
    raise OperationalError(e[0])
pymssql.OperationalError: (20009, 'Net-Lib error during Unknown error')
like image 270
user1050619 Avatar asked Mar 29 '13 15:03

user1050619


1 Answers

I ran into the same Net-Lib error during Unknown error error message. For me, the issue was that I needed to enable TCP/IP and Named Pipes in my instance of SQL Server Express.

Try going into SQL Server Configuration Manager and turning on both TCP/IP and Named Pipes.

like image 146
Matt Avatar answered Sep 28 '22 23:09

Matt