0

i'm trying to connect to an old Access database (c:\content.mdb) using the odbc driver Microsoft Access Driver (*.mdb) version 10.00.22624.01 (installed from this link: https://www.microsoft.com/en-us/download/details.aspx?id=13255).

The connection string i'm using is the following: Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\content.mdb; Uid=; Pwd=;

If i try to connect with an ancient php version (php v5.4.45, which has odbc extension v1.0), everything is fine.

If i try to connect with a "modern" php version (php v8.1.12 with odbc extension v8.1.12) or any DBMS supporting odbc (eg DBeaver v22.2.4, which uses jdbc:odbc), i get the following error:

SQLSTATE[IM002] SQLDriverConnect: 0 [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

The connection string (hence the odbc driver used) is exactly the same. Using php's PDO or odbc_* functions yields the same results.

So why is this happening? Why does it work with php 5.4 but fails with anything else?

aetonsi
  • 208
  • 2
  • 9
  • 2
    This is likely entirely related to bitness, with modern systems being 64 bits by default. The old *.mdb driver is not installed from the link you provided, but is present on windows by default and only available for 32-bits programs, use the more modern mdb/accdb driver. – Erik A Nov 11 '22 at 10:55
  • hello mr Erik and thank you! that was the problem! For future reference, i installed the x64 driver from the same link, and then changed the DSN to use the driver `Microsoft Access Driver (*.mdb, *.accdb)`. Then it worked both with php8 and Dbeaver (which are x64). Thanks again! – aetonsi Nov 11 '22 at 11:07

0 Answers0