0
votes

Hi i am trying to connect with visual fox pro driver using .dbc file here is the code

$dsn = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=C:\DataMnt\WINSIMS.DBC;Exclusive=NO;collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO;";
$conn = odbc_connect($dsn, "", "");
if (!$conn)
    exit("Connection Failed: " .$conn );

i am getting below error please help

Error :-( ! ) Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\wamp64\www\testfiles\odbc_test.php on line 15

even i have installed the driver and its showing in my odbc drivers list and from there i have added that driver and defined .dbc file location.

but still i am getting this error i have read out all stack overflow posts but did not get success so please help. I have added attachment of driver which i have added.

i am using wamp 64 bit on windows 64 bit system i have tested mysql connector driver and that was working fine. i just have .dbc file is there any need of username and password ? or i can fill them blank.

attachmenet Thanks in advance !

Update :- Microsoft Visual FoxPro Driver is showing in windows->SysWOW64->odbcad32.exe but not showing in windows->system32->odbcad32.exe

1
Within a 64-bit system windows->system32->odbcad32.exe is where 64-bit drivers will appear. windows->SysWOW64->odbcad32.exe is where the 32-bit drivers will appear. The Foxpro/Visual Foxpro driver is 32-bit - Dhugalmac
SourceDB=C:\DataMnt\WINSIMS.DBC --- Are you looking to connect to Data Table (a DBF file) that is contained within a VFP Database (a DBC file) ? If not you need to change that part of your Connect String. Check out: connectionstrings.com/visual-foxpro - Dhugalmac

1 Answers

1
votes

I currently have Foxpro ODBC driver running on Windows 10. It interacts with PHP 5.6 in XAMPP 32 bit. The queries are working. I compared your connection string with mine. It looks fine except the path to sourceDB may need to be separated by double back slashes. I have user DSN instead of system DSN. Here's a screen shoot of my ODBC admin panel. ODBC admin panel