If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > AdoDB and Visual Foxpro (dbf) connection

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-20-11, 11:01
breakline breakline is offline
Registered User
 
Join Date: Dec 2011
Posts: 2
AdoDB and Visual Foxpro (dbf) connection

Hi

I'm new here so forgive me if this is the wrong board, might be to post in the Databases board but oh well.

So after hours of trying to connect to a Visual Foxpro data provider (thanks whoever made it this hard) I finally have a connection, but still cannot reach the table.

What I have:

a wamp server and php and adoDB for php package
under c:/wamp/www

I have a dbf.php

under c:/wamp/www/test

I have a dbf file called staru.DBF

Now I'm trying to connect to this from the dbf.php file:

Code:
<?php
$path = "adodb514/adodb5/adodb.inc.php";
$path2 = "adodb514/adodb5/adodb-exceptions.inc.php";
include($path);
include($path2);
try {
$conn = new COM("ADODB.Connection");
$conn->Open("Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=c:\wamp\www\test\staru.DBF;Exclusive=No;BackgroundFetch=No;");
$rs = $conn->Execute("select * from staru");
while ($array = $rs->FetchRow()) {
    print_r($array);
}
}
catch (exception $e) {
    printf($e);
}
?>
What I get is:

Code:
exception 'com_exception' with message 'Source: Microsoft OLE DB Provider for ODBC Drivers
Description: [Microsoft][ODBC Visual FoxPro Driver]File 'staru.dbf' does not exist.' in C:\wamp\www\dbf.php:9 Stack trace: #0 C:\wamp\www\dbf.php(9): com->Execute('select * from s...') #1 {main}
Any ideas how to fix this? I'm on MS Server 2003

Thank you in advance
Reply With Quote
  #2 (permalink)  
Old 12-20-11, 11:23
kitaman kitaman is offline
Papabi's friend
 
Join Date: Sep 2009
Location: Ontario
Posts: 629
One thing that I noticed is that the database name is "staru.DBF" (mixed case) in the source code, but "staru.dbf" (all lower case) in the error message.
Reply With Quote
  #3 (permalink)  
Old 12-20-11, 11:29
breakline breakline is offline
Registered User
 
Join Date: Dec 2011
Posts: 2
Quote:
Originally Posted by kitaman View Post
One thing that I noticed is that the database name is "staru.DBF" (mixed case) in the source code, but "staru.dbf" (all lower case) in the error message.
Yeah I actually tried most variations and renamed the file too but it didn't work.

What I don't get is that there are no table names here, only file names so I have to use the file name in the SELECT statement because the sql needs it...
Reply With Quote
Reply

Tags
visual foxpro

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On