Cannot connect to Access DB using pyodbc

后端 未结 2 1352
忘了有多久
忘了有多久 2021-01-06 06:12

I\'ve been beating my head against this for a few days now. I\'m trying to use pyodbc to connect to a Microsoft Access DB, and I can\'t seem to get the connection string rig

相关标签:
2条回答
  • 2021-01-06 06:42

    This is a 64-bitness problem. I solved it by using 32-bits python and pyodbc.

    0 讨论(0)
  • 2021-01-06 07:03

    Try adding Provider=MSDASQL. It's deprecated but it seems to work OK:

    cnxn = pyodbc.connect(r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};
    DBQ=C:\Path\to\file.accdb; Provider=MSDASQL;')
    
    0 讨论(0)
提交回复
热议问题