0

I am trying to read a table from access DB and use it as dataframe of pandas. I am trying to read it from cloud. This database is not present in my local system. Although i tried copying the table to local system and in same directory in which program is written but still getting same error. I have used this code:

conn=pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};'
r'DBQ=APR.accdb;'
r'Provider=MSDASQL')
#conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\Users\somya_chaturvedi1\Box\Pre APR Automation\eWB - FrontEnd v6.3.3 - CRISIL.accdb;')
cursor = conn.cursor()
cursor.execute('select * ABS/RMBS APRs')
   
for row in cursor.fetchall():
    print (row)

I am getting following error for this one:

InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')

I tried to check version of both python and Ms access to both be 32 bit. i am not able to configure and what should be done. Please Help Thank you

  • 1
    Note that some installations of Office 365 come with Access, but are not registering the Access ODBC driver. In those cases, you will need to separately install the Access database engine. Check the ODBC driver pane to see if you have the driver available to you (which will likely not be the case, else you wouldn't get this error). – Erik A Jan 05 '21 at 09:03
  • @ErikA i checked ODBC driver . i hve it for both 64-bit and 32-bit.i also also have *.mdb and *.accdb . – somya p chaturvedi Jan 05 '21 at 10:38
  • 1
    Then you have a problem. As stated in my answer on the duplicate, simultaneous installations of the 32-bit and 64-bit ODBC driver are not supported (Access automatically blocks installation of the other if you have the first). You can sometimes try to work around that using things like the `/silent` switch on the installer, which is known to cause a ton of problems. In situations like that, I recommend a full uninstall, reboot, then reinstall of both Office and the database engine. (uninstall both, reinstall Office first, reboot at all steps). – Erik A Jan 05 '21 at 10:41

0 Answers0