0
I am trying to connect to SQL Server database using pyodbc lib in Python, but I am encountering error right from the start.
Follow the code and error below.
Script:
import pyodbc
conn = pyodbc.connect('Driver = {SQL SERVER Native Client 11.0};'
'Server = DESKTOP-3TFNKAR;'
'Database = Aula1;'
'Trusted_connection = yes;')
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE Professor (
Nome varchar(100),
Idade varchar(10),
Email varchar(100)
)
''')
conn.commit()
Error:
conn = pyodbc.connect('Driver = {SQL SERVER Native Client 11.0};'
pyodbc.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Nome da fonte de dados n�o encontrado e nenhum driver padr�o especificado (0) (SQLDriverConnect)')
I made the modification of 'Driver = {SQL Server};
for 'Driver = {SQL SERVER Native Client 11.0};
as an attempt, because from what I understood my driver is this.
Anyway, I’m very beginner, so explanations are also welcome.
Gift!!
Decided to change the driver to what you suggested. Thank you so much!
– BeatrizGomes