[Python] How to connect to SQL using Pyodbc

Discussão em 'Python' iniciado por Stack, Março 29, 2025.

  1. Stack

    Stack Membro Participativo

    I want to connect to a SQL server using Pyodbc, but it always display the same error.

    This is my code so far:

    import pyodbc
    try:
    conn = pyodbc.connect('DRIVER = {SQL Server};SERVER=master;DATABASE=Clinica;UID=djimenez;PWD=PRIVATE')
    print ("Conexion succesful")
    except Exception as ex:
    print(ex)


    and the displaying error is:

    ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found and no default driver specified (0) (SQLDriverConnect)')


    I'm still a novice in this kind of stuff, So i don't know what that means. I used the terminal and looked

    where unixODBC


    and it said that it was not found. I tried to install it but it said it was already installed. I search up my problem and i came across to MarkLogic. I tried to download that but apparently, it isn't compatible to Mac M1, that's where i am. SO im stuck and don't know what to do.. Any help please?

    Continue reading...

Compartilhe esta Página