Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I need help, I'm trying to connect to an access database .mdb maybe from 2002,I am trying with pyodbc bat it tells me that the program is done whit older version.

code:

Python
import pyodbc
conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\Users\nio74\Desktop\dati.mdb;PWD=gmpa;')
cursor = conn.cursor()


Error:
pyodbc.Error: ('HY000', "[HY000] [Microsoft] [ODBC Microsoft Access Driver] Cannot open a database created with a previous version of the application. (-1019)



Some idea?

What I have tried:

I have search driver OlEDB becouse i had made an application in PHP I was working with that driver, but I can't find for python
Posted
Updated 12-Dec-20 2:06am

Chances are that you've got a 2013 or later version of the Access DB engine installed, and that cannot open pre 1997 .MDB files at all. You will need to either get an earlier version that can, or update your DB to a more modern standard.

The later is almost certainly the simpler route!
 
Share this answer
 
Comments
Paolo Mazzon 12-Dec-20 8:11am    
unfortunately the database works on a management system and I cannot update it I have to find another way
Paolo Mazzon 12-Dec-20 15:26pm    
unfortunately the database works on a management software (I do not have access to the source code) and I cannot convert it to a more recent version otherwise the management system no longer works
Try to connect the database using the old Access driver (no .accdb).
Old driver is still part of Microsoft OS (also Win 10), unfortunately as 32-bit version only, so you have to use Python 32-bit.

import pyodbc
conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Users\nio74\Desktop\dati.mdb;PWD=gmpa;')
cursor = conn.cursor()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900