[Python] PyCharm Connection to SQL Server

Discussão em 'Python' iniciado por Stack, Junho 27, 2025.

  1. Stack

    Stack Membro Participativo

    I am using Pycharm and try to link to a mssql server. When I link to a server that requires SQL authentication, the connect is created successfully. However, when I try to link to a server that requires my Windows Authentication, even though I use my username or password of windows log in, I cannot connect successfully. May I know what should be a proper way to setup if it is windows authentication.

    I am using the below code:

    import pymssql
    conn=pymssql.connect(host="10.xx.xx.xx",user="CORPORATE/mywindowsloginname",password="mypassword",database="BIC_reference")
    cur=conn.cursor()y
    cur.execute('SELECT top 10 * FROM dbo.hi_invoiceline')
    print (cur.fetchall())

    Continue reading...

Compartilhe esta Página