How can PDO be utilized to address the issue of accessing and querying multiple MDB files in PHP?

When dealing with multiple MDB files in PHP, the issue arises with the lack of native support for MDB files in PDO. One way to address this is by using the ODBC (Open Database Connectivity) driver to connect to the MDB files. By setting up a DSN (Data Source Name) for each MDB file, we can then use PDO to query and access the data from these files.

try {
    $dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=path/to/firstfile.mdb");
    $stmt = $dbh->query("SELECT * FROM table_name");
    while ($row = $stmt->fetch()) {
        // process the data
    }
    $dbh = null;
} catch (PDOException $e) {
    echo "Error: " . $e->getMessage();
}