I'm trying to connect microsoft access database that resides on a mapped network drive.
If I copy the .mdb file and put it locally I have no problem connecting and running queries but as soon as I try connect to the live version on the network I fail.
Here is what I have
//Works
try {
$dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=C:/xampp/htdocs/inventory/ORSDATA.mdb;Uid=; Pwd=;");
}
catch (PDOException $e)
{
//Does Not work
try {
$dbh = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=cerfs1/f:/orsdata/ORSDATA.mdb;Uid=; Pwd=;");
}
catch (PDOException $e)
{
Where cerfs1 is the name of the server f: is the actual server drive letter /orsdata is the server folder and orsdata.mdb is the database.
I have tried numerous variations using shared drive letter Y:/orsdata.mdb and IP address (10.50.10.12) instead cerfs1. I get the following errors:
Dbq=//cerfs1/orsdata/ORSDATA.mdb -> SQLSTATE[HY000] SQLDriverConnect: -1811 [Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.
Dbq=//cerfs1/f:/orsdata/ORSDATA.mdb ->SQLSTATE[HY024] SQLDriverConnect: -1023 [Microsoft][ODBC Microsoft Access Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
Dbq=cerfs1/f:/orsdata/ORSDATA.mdb ->SQLSTATE[HY000] SQLDriverConnect: -1044 [Microsoft][ODBC Microsoft Access Driver] Not a valid file name.
Dbq=10.50.10.12/f:/orsdata/ORSDATA.mdb -> SQLSTATE[HY000] SQLDriverConnect: -1044 [Microsoft][ODBC Microsoft Access Driver] Not a valid file name.
//Shared Drive is Y which is mapped to F:/orsdata
Dbq=Y:/ORSDATA.mdb -> SQLSTATE[HY024] SQLDriverConnect: -1023 [Microsoft][ODBC Microsoft Access Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
I read as much as I possible could about trying to connect to a mapped drive / database but nothing I have tried seems to work. The odd thing is I can go in through Excel on my local computer and pull the data from the network drive, but not through php / xampp. Any help is very much appreciated.