[Python] Cannot establish connection to SQL Server using pyodbc

Discussão em 'Python' iniciado por Stack, Dezembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    Cannot establish connection to SQL Server using pyodbc on Windows. Here are the steps I use:

    import pyodbc as odbc

    import pandas as pd

    cnxn=odbc.connect(cnxn_str)


    in the last step it shows this error

    OperationalError Traceback (most recent call last)
    Cell In[25], line 1
    ----> 1 cnxn=odbc.connect(cnxn_str)

    OperationalError: ('08001', '[08001] [Microsoft][ODBC Driver 17 for SQL Server]SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. (-1) (SQLDriverConnect); [08001] [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (0); [08001] [Microsoft][ODBC Driver 17 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. (-1)')



    I've writen the server name right, and checked about Port 1433.

    Please help.

    Continue reading...

Compartilhe esta Página