mphagan Posted April 19, 2006 Share Posted April 19, 2006 Hello,I developed code to connect via ADODB ODBC to a Visual Foxpro dbf file. Everything worked fine when the db file was on the local drive. When I change the path to a network drive map, the connect fails. I have tried on different network drive, using both a standard windows map and UNC.Here is the code:<?phpinclude('C:\Program Files\Internet\adodb\adodb.inc.php');//include("C:\Program Files\Internet\adodb\adodb-exceptions.inc.php");// Path to dbase file// connects to file on local drive//$db_path = "C:\Program Files\Internet\Apache\Apache2\htdocs";// does not connect to network drive, using drive map or unc//$db_path = "\\\Server\share";$db_path = "T:\share";$db =& ADONewConnection('vfp');$dsn = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=$db_path;Exclusive=No;";$db->debug = true;$db->Connect($dsn);try { $rs = $db->Execute("select * from dbftable");} catch (exception $e) { print_r($e);}if (!$rs) { echo "Not Connnected!";}***************The error I get is:Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Visual FoxPro Driver]File 'dbftable.dbf' does not exist., SQL state S0002 in SQLExecDirect in C:\Program Files\Internet\adoDB\drivers\adodb-odbc.inc.php on line 530S0002: [Microsoft][ODBC Visual FoxPro Driver]File 'dbftable.dbf' does not exist.ADOConnection._Execute(select * from dbftable, false) % line 856, file: adodb.inc.phpADOConnection.Execute(select * from dbftable) % line 22, file: foxado.phpNot Connnected!Fatal error: Call to a member function FetchRow() on a non-object in C:\Program Files\Internet\Apache\Apache2\htdocs\foxado.php on line 42*************This is running on PHP 5, ADO version 4.8.Thanks, Mark Quote Link to comment Share on other sites More sharing options...
mphagan Posted April 21, 2006 Author Share Posted April 21, 2006 Found the answer to my own question. Posting the answer, incase it will help someone else.Turned out to be a rights issue. The account I was logged in as had rights to the network drive map, but apache did not. Apache was running as a service using "Log on as: Local System Account". The Local System account had no rights to the network resource. I changed Apache to run under a network account with rights to the mapped drive and the code works. Should have seen this earlier!Mark Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.