I am trying to fetch data from DBF files from a .NET REST service. These files are the bussiness data of another application. This is quite an old app, so dBase/FoxPro is what I have to handle.
I only want to read data. I’m not interested by now in updating/inserting.
My service works OK and I can retrieve JSON messages with the data. The problem emerges when the other app is running. If I try to acces data when the other app is running I get a “ERROR [HY000] [Microsoft][ODBC dBase Driver] External table is not in the expected format.”. As long as I can access the data when the other app is not running, the error message sounds weird.
Another software like the DBF explorer can access the data with the other app running, so I think it must be some bad configuration on the connection string or the driver.
Does anybody know how to configure de ODBC connection in order to access these tables while they are open by other apps?
Thank you in advance!
P.S.: My connection string:
@"Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=" + pathtoDBFFile + ";";
First, I would not be using the dBASE driver, but instead, download and use the Visual FoxPro OleDb driver from MS.
In addition, the connection string, you can make the setting for “Exclusive Use” default to No as the following sample from ConnectionStrings.com. The Driver portion is incorrect for the OleDb provider, but the context of Exclusive=No, deleted=no, and whatever other settings you can throw in there can help.
Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=c:\myvfpdb.dbc;Exclusive=No; NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO;
Another link that reference connection to VFP tables, and a link for downloading the VFP OleDB provider.