I wrote a program that uses pyodbc to connect to Access

import pyodbc #import kinterbasdb import firebirdsql import os, sys import json,sqlite3,sql sys.version_info s1=''' create table CLIENTS ( ID INTEGER NOT NULL, COMPANY VARCHAR(50), "LAST NAME" VARCHAR(50), "FIRST NAME" VARCHAR(50), "E-MAIL ADDRESS" VARCHAR(50), "JOB TITLE" VARCHAR(50), "BUSINESS PHONE" VARCHAR(25), "HOME PHONE" VARCHAR(25), "MOBILE PHONE" VARCHAR(25), "FAX NUMBER" VARCHAR(25), ADDRESS BLOB SUB_TYPE 1, CITY VARCHAR(50), "STATE/PROVINCE" VARCHAR(50), "ZIP/POSTAL CODE" VARCHAR(15), "COUNTRY/REGION" VARCHAR(50), "WEB-SITE" VARCHAR(25), NOTES BLOB SUB_TYPE 1, INCLUDING BLOB, CONSTRAINT PK_CLIENTS_ID PRIMARY KEY(ID) ); ''' s2='''create ascending index IDX_CLIENTS_CITY on CLIENTS (CITY);''' #os.remove('D:/ThirdTask/test1.fdb') conn=firebirdsql.create_database(host='localhost', database='/test1.fdb', user='sysdba', password='masterkey') #con=firebirdsql.connect(host='localhost',database='D:/ThirdTask/test1.fdb', user='sysdba', password='masterkey') cur=conn.cursor() cur.execute(s1) #cur.execute(s2) conn.commit() conAcc = pyodbc.connect('DRIVER={Microsoft Access Driver (*.accdb)};DBQ=Northwind.accdb') conn.close() 

As a result, it gives an error

 Traceback (most recent call last): File "D:\ThirdTask\ connecttwo.py ", line 39, in <module> conAcc = pyodbc.connect('DRIVER={Microsoft Access Driver (*.accdb)};DBQ=Northwind.accdb') Error: ('IM002', '[IM002] [Microsoft][\xc4\xe8\xf1\xef\xe5\xf2\xf7\xe5\xf0 \xe4\xf0\xe0\xe9\xe2\xe5\xf0\xee\xe2 ODBC] \xc8\xf1\xf2\xee\xf7\xed\xe8\xea \xe4\xe0\xed\xed\xfb\xf5 \xed\xe5 \xed\xe0\xe9\xe4\xe5\xed \xe8 \xed\xe5 \xf3\xea\xe0\xe7\xe0\xed \xe4\xf0\xe0\xe9\xe2\xe5\xf0, \xe8\xf1\xef\xee\xeb\xfc\xe7\xf3\xe5\xec\xfb\xe9 \xef\xee \xf3\xec\xee\xeb\xf7\xe0\xed\xe8\xfe (0) (SQLDriverConnect)') 
  • one
    Maybe a readable error will clarify the situation [IM002] [Microsoft] [ODBC Driver Manager] Data source not found and the default driver used is not (0) (SQLDriverConnect) - moden
  • one
    @moden, sorry for the incompetence, but you can explain in more detail. - ivan89
  • I myself have no idea. Just translated the text of the error. - moden

1 answer 1

Should have been used instead

 conAcc = pyodbc.connect('DRIVER={Microsoft Access Driver (*.accdb)};DBQ=Northwind.accdb') 

next connection string

 conAcc = pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=Northwind.accdb')