OiO.lk Blog PHP PHP PDO Microsoft Access Driver is returning a 500 error
PHP

PHP PDO Microsoft Access Driver is returning a 500 error


Attempting to read an access file into a PDO.

$db = "D:/VacConJobTrackerbe.accdb";

if (!file_exists($db)) {die("Could Not find database file.");}
else {echo "Found Database file.<br/>";}

$jobTrackerConn = new PDO("odbc:Dbq=$db;Charset=UTF-8;Driver={Microsoft Access Driver (*.mdb, *.accdb)};Uid=Admin;");

I get a 500 error.

The php logs are clean. Other parts of my application successfully read from a sql server.

odbc Data Source Administrator 64-bit lists ‘Microsoft Access Driver (*.mdb, *.accdb)’
16.00.18025.20030

PDO::getAvailableDrivers() returns odbc & mysql

php.ini has both extension=odbc and extension=pdo_odbc un-commented

php 8.3.12, 64 bit

office 365 & access runtime version 16.0.18025.20160 64 bit

Windows Server 2016 Datacenter
IIS Version 10.0.14393.0

I’ve tried swapping the driver & dbq in the connection string, omitting charset, and many other permutations. Adding Uid=Admin had no effect. Misspelling the driver results in a different (non-500) error. So does misspelling the file.



You need to sign in to view this answers

Exit mobile version