Python Forum

Full Version: Connection with SQL Server
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello all!

I'm trying to connect to SQL Server, but i keep getting the message: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)'.

I'm using Pycharm, and i also made sure i installed pyodbc and pypyodbc.

Any Suggestiongs?

Here is my code:

import pyodbc

class DBConn:


    conn = pyodbc.connect("Trusted_Connection='yes';"
                          "driver='SQL Server}';"
                          "server='my Server';"
                          "database='QUERYTRAINING")

    if conn:
        print("We are connected")

        conn.close()