i want to read data of an MDB access file with my laravel project. I'm trying with a local file but i got this errors:
Could not find database file.
The code of my test is:
$dbName = $_SERVER["DOCUMENT_ROOT"] . "C:\Temp\test.mdb";
if (!file_exists($dbName)) {
die("Could not find database file.");
}
$db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid='Admin'; Pwd=;");
And
try
{
$db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\Temp\test.mdb; Uid=; Pwd=;");
}
catch(PDOException $error_mess)
{
echo $error_mess->getMessage();
}
With error:
SQLSTATE[IM002] SQLDriverConnect: 0 [Microsoft][Driver Manager ODBC] Nome origine dati non trovato e driver predefinito non specificato.
I managed to get the two databases to communicate starting from the access file and following this guide :Exporting Access Data to MySQL.
I don't want to use this method. What I would like to read is the db access from laravel. It's possible? Can you help me?
Here some screenshot of my phpinfo and ODBC Drivers:
Probably is the drivers, someone can help me?
I solved and entered the PDO connection in the database file like this:
'access' => [
'driver' => 'odbc',
'dsn' => 'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=C:\Temp\test.mdb;',
'database' => 'test.mdb',
'username' => '',
'password' => ''
]