PYmssql python connection string

16,041

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.

Share:
16,041
user1050619
Author by

user1050619

Updated on June 17, 2022

Comments

  • user1050619
    user1050619 almost 2 years

    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')