I'm using the pandas dataframe's to_sql function to save records to MS Access 97 MDB. But I'm getting the error below:
pyodbc.Error: ('HY104', '[HY104] [Microsoft][ODBC Microsoft Access Driver]Invalid
precision value (98) (SQLBindParameter)').
I'm using Python 3.8.5 32-bit on a Windows 10 Workstation.
I also have the following libraries installed.
datacompy==0.7.1
et-xmlfile==1.0.1
jdcal==1.4.1
numpy==1.19.2
openpyxl==3.0.5
pandas==1.1.2
pyodbc==4.0.30
python-dateutil==2.8.1
pytz==2020.1
pywin32==228
six==1.15.0
SQLAlchemy==1.3.19
sqlalchemy-access==1.0.7
Thanks in advance!
You have encountered a limitation of the Access ODBC Driver when working with Access_97 database files. In Python_3 all strings are Unicode, but Access did not start supporting Unicode until Access_2000.
This code fails with the error you describe
for values of
num_charactersgreater than 127 when working with an Access_97 (Jet 3.5) .mdb file. The same code does not fail when working with an Access_2000 (Jet 4.0) .mdb file.As a workaround you might be able to use something like this
but a better solution would be to upgrade the database file to a newer version. The Access_97 file format has been deprecated for many years and is now completely unsupported by Microsoft.