0
import pyodbc

my_db_path = r'C:\testing\mydb.accdb'
my_db_pw = r'djw85nawj12'

conn = pyodbc.connect(r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=%s;PWD=%s' % (my_db_path, my_db_pw))

#in python 3.7.2 (pyodbc 4.0.32)  -> works, returns conn object
#in python 3.11.3 (pyodbc 4.0.39) -> error: data source name not found and no default driver specified

I need to get this working in 3.11.3 and I don't understand why it fails. I tried multiple variations with and without usage of raw strings. What's happening in 3.11.3?

TylerH
  • 20,799
  • 66
  • 75
  • 101
R-obert
  • 553
  • 4
  • 13
  • I have found a likely cause: using pyodbc.drivers() reveals a long list of drivers for 3.7.2 but in 3.11.3 I only see `SQL Server`. Why is it different? – R-obert May 26 '23 at 15:23
  • Alright, I found the cause: my Python 3.7.2 is a 32-bit Python installed long ago. My 3.11.3 Python is a 64-bit Python installed quite recently. On my Windows machine, I have a lot of 32-bit drivers available, but only 1 64-bit driver. I need to figure out not, how to install the 64-bit drivers :) – R-obert May 26 '23 at 15:39

0 Answers0