Reputation: 13384
I want to establish a connection to ms access server from external system using php pdo. I have tried it in the same server by using the following code
$dbName = $_SERVER["DOCUMENT_ROOT"] . "test\test.mdb";
if (!file_exists($dbName)) {
die("Could not find database file.");
}
$db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid=; Pwd=;");
I want to know how to access the ms access
which is in the external server. Have tried to mention the server in the above code like
$db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; SERVER={ipaddress};DBQ=$dbName; Uid=; Pwd=;");
but there is no response. Can any one please explain me how establish connection to ms access external server using php pdo. We have to do anything with driver?
Upvotes: 0
Views: 269
Reputation: 123549
The machine running PHP must be able to "see" an SMB (Windows File Sharing) shared folder that contains the Access database file on the other machine. PHP can then open it using a UNC path, e.g.
Dbq=\\servername\sharename\foldername\filename.mdb
Note that there is no such thing as a Server=
parameter in an Access ODBC connection string.
Upvotes: 1