Hi,
Make sure the DB is not open by somebody else on the network (from the looks of things X is your network drive) or else add the Username and Password to the connection string. If there are any other programs / websites accessing the database this could present a problem, in this case make sure that the apps / websites close their connections. Try the below code and see if it works. If that doesn't work then try to create a fresh database on your local drive and test that (It could be just that MS Access is crap ;)).
<?php
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
// Providing username and password exist (Make sure your OLEDB Driver version matches!)
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=X:\mdb\mydata.mdb; UID=username; Password=yourpassword");
// Create and populate recordset $rs = $conn->Execute("SELECT * FROM sometable;");
// Loop through recordset and display 1 column from some table while (!$rs->EOF) { $rs->Fields[somecolumnname]->Value; $rs->MoveNext(); }
// Close the recordset and destroy the object $rs->Close(); $rs->Release(); $rs = null;
// Close the connection and destroy object
$rs->Close(); $rs->Release(); $rs = null;
?>
|
----- Original Message -----
Sent: Thursday, November 25, 2004 9:01 PM
Subject: [PHP-WIN] Permission deny on connecting MS Access database
Hi all, I need help to solve my problem, I use ADO to connect MS Access database; the data is store in another server computer; I have try two different way to access the data, and below is the code: ----------------------------------------- //$dbName = " \\SERVER\mdb\mydata.mdb"; $dbName = "X:/mdb/mydata.mdb"; $conn = new COM('ADODB.Connection');
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$dbName;Persist Security Info=False");
output: ------------------------------------------ Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft JET Database Engine Description: The Microsoft Jet database engine cannot open the file 'X:\mdb\mydata.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
Thanks
åç
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php | |