Visual FoxPro ODBC driver

Visual FoxPro ODBC driver was last updated around VFP6 SP3. It supports a subset of VFP 6.0 features but not any new ones introduced in VFP7 and later. See VFP 6.0 Help file and Unsupported Visual FoxPro Commands and Functions (Visual FoxPro ODBC Driver) for additional information. It'll not recognize any tables that use VFP7 and later new features and either ignore them or give an error when trying to access them.

The VFP ODBC driver was included in MDAC 2.5 and earlier and preinstalled on Windows 2000 and earlier. In order to use it on Windows XP and later Windows versions, it has to be installed first. The Microsoft Visual FoxPro Driver 6.01.8629.01 is available for download at http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx.

The VFP ODBC Driver can be installed under 64-bit Windows but 64-bit applications cannot access VFP ODBC driver because it comes only in 32-bit version. For 32-bit applications under 64-bit Windows there's ODBC Data Source Administrator for the 32-bit ODBC drivers %systemdrive%\Windows\SysWoW64\odbcad32.exe (usually C:\WINDOWS\SysWOW64\odbcad32.exe).


VFP ODBC Driver Options
Option Connection string Description Notes
Collating sequence Collate The sequence in which fields are sorted. The default sequences reflect the sequences supported by your language version of the operating system. For a list of supported collating sequences, see SET COLLATE.
Exclusive Exclusive Determines if the driver opens the Visual FoxPro database exclusively when you access data using the data source. Other users cannot access the database or the tables in the database while the database is opened exclusively. Tables within the exclusively opened database are opened as SHARED. To open a table exclusively, use the SET EXCLUSIVE command. This check box is disabled when Database type is set to Free Table directory. Yes/No
Null Null Determines whether columns created with ALTER TABLE and CREATE TABLE allow null values. If you set Null ON, INSERT – SQL inserts a null value into any column not included in an INSERT – SQL... VALUE clause. A blank is inserted if Null is OFF. Yes/No
Deleted Deleted Determines whether rows marked as deleted are returned. Deleted=Yes is the same as SET DELETED ON. Yes/No
Fetch data in background BackgroundFetch Determines whether records will be fetched in the background (progressive fetching) or your application will wait until all records in the result set are fetched. It's recomended to set it to No. See PRB: Problems with Visual FoxPro Driver "Fetch Data In Background" Option for details. Yes/No


The code below shows how to use VFP ODBC in SPT with DSN-less connection.

$SAMPLECODE$

CLEAR
 
* Attempt to access Northwind.dbc with VFP ODBC driver will generate the error below because the DBC has DBC events enabled:
*  Connectivity error: [Microsoft][ODBC Visual FoxPro Driver]File was created in a later version of Visual FoxPro than the current version.
*lcDbc = HOME(2) + "Northwind\Northwind.dbc"
 
lcDbc = HOME(2) + "Data\testdata.dbc"
 
TEXT TO lcConnStr TEXTMERGE NOSHOW
DRIVER=Microsoft FoxPro VFP Driver (*.dbf); 
	Deleted=Yes; Null=Yes; Collate=Machine;
	BackgroundFetch=No; Exclusive=No; 
	SourceType=DBC; SourceDB=<<lcDbc>>
ENDTEXT			
 
lnConn = SqlStringConnect(lcConnStr)
IF lnConn < 0
	=AERROR(laError)
	? laError[1,2]
	RETURN
ENDIF	
 
TEXT TO lcSql NOSHOW
SELECT * FROM Products 
ENDTEXT
 
lnResult = SQLEXEC(lnConn, lcSql, "crsProducts")
IF lnResult < 0
	=AERROR(laError)
	? laError[1,2]
	RETURN
ENDIF	
 
BROWSE LAST NOWAIT

Comments

Sybase has a (commercially available) odbc-driver for VFP9 including all new data types. For those who want to spent money to be able to use an updated ODBC driver, it can be found at http://www.sybase.com/products/databasemanagement/advantagedatabaseserve....

The Sybase ODBC driver is for Advantage Server which in turn can access VFP tables (including VFP 9.0 tables). IOW, it requires Advantage Local Server or Advantage Database Server. Advantage Local Server is included with the driver, though.

Advantage does not support direct access to the database container (DBC) file. It requires to run DBCConvert.prg to convert DBC into Advantage metadata. It doesn't support VFP stored procedures either.

Downloads:
Advantage OLE DB Provider
Advantage ODBC Driver.

The use of the ODBC driver and Advantage Local Server is free but severely limited w/o the Advantage Database Server (http://www.sybase.com/products/databasemanagement/advantagedatabaseserve...)

Licensing note:
If an Advantage application is distributed to work without the Advantage Database Server (i.e., it uses the Advantage Local Server to access data), the application must act as a "client" that directly accesses and uses the data. The application cannot act as "middleware" or as a "server" by having the data forwarded by any means to a separate computer. In other words, it is illegal to use the Advantage Local Server with a Web server, an application server, a terminal server or any other type of middleware or server product to access data on behalf of remote computers. An Advantage Database Server (a.k.a. remote server) product must be purchased and used to allow an Advantage application to access data on behalf of applications running on remote computers.

Wow-I don't know how I found this article but this is exactly what I needed to know to add a Visual FoxPro datasource to a Server 2008 64-bit system. I never would have found that odbcad32.exe file - ever.

Thanks!

Man... I've searched all day until I typed those correct words into Google and found this. Thank you SOOOOOO much.

"The VFP ODBC Driver can be installed under 64-bit Windows but 64-bit applications cannot access VFP ODBC driver because it comes only in 32-bit version. For 32-bit applications under 64-bit Windows there's ODBC Data Source Administrator for the 32-bit ODBC drivers %systemdrive%\Windows\SysWoW64\odbcad32.exe (usually C:\WINDOWS\SysWOW64\odbcad32.exe)."
haha... who knew.

Super!!!

Merci !!! (thanks)

Windows 8 64 bits - ODBC VFP9

With Windows 7 64-bit no problem.
I have a PC with Windows 8 64-bit on the ODBC, does not show the driver VFP9.
To take into account, using SysWOW64 \ odbcad32.exe not work.
Does anyone know how to solve?
Please, i need help !!!!!

I have the same problem , I have to create a dsn connection with foxpro driver but is not present in the list , Have You solved in any way?

Hi

When I try to run the installer on Windows 7 all I get is "Internal Error 2738".

Simon

I had no problem installing VFP ODBC driver under Windows 7 32-bit. Try to run install "as administrator".

even it is vry hard to get @ found this article,, im vry thankful parin... bcoz i founf what i need to find...

thank u!

Hy!!! i have some dbf files, and i want to make querys from php, i dont find the real driver, i was using
Microsoft Access dBase Driver (*.dbf, *.ndx, *.mdx) driver , once it works. but now it craps!!

my php code is.
if ($conn = odbc_connect('DBFP3','',''))
echo "connected";
else
echo "not connected";
odbc_close($conn);

( ! ) Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in F:\servidor\www\Web\clientes\alcomex.com.mx\sistema\Dropbox\www_server\www\SISTEMAACOM\modulo_pruebas\prueba2.php on line 4

please really i need help.

Fantastic... I did this a few weeks ago without taking notes. I was going crazy trying to create a new Data Source. Couldn't understand why the DataSources were staying active though I could not see them in DataSources Manager (Win 6 64 Bit).

I installed: VFBODBC.exe (Visual FoxPro ODBC)
then
MySQL Connector ODBC
..
then to access the Visual Fox Pro Creation routing:
RUN
C:\WINDOWS\SysWOW64\odbcad32.exe

and All Good. (Also Logging to my Evernote now)

"The VFP ODBC Driver can be installed under 64-bit Windows but 64-bit applications cannot access VFP ODBC driver because it comes only in 32-bit version. For 32-bit applications under 64-bit Windows there's ODBC Data Source Administrator for the 32-bit ODBC drivers %systemdrive%\Windows\SysWoW64\odbcad32.exe (usually C:\WINDOWS\SysWOW64\odbcad32.exe)."
haha... who knew.

After 3 hours 45 minutes ... I found the correct folder name ... \SysWOW64\ . Thanks again L.Arnold!

I was able to install VFP ODBC driver (6.01.8629.01) on Windows 7 Pro 64-bit.
It didn't show up in ODBC Data Source Administrator.

C:\WINDOWS\SysWOW64\odbcad32.exe was the key !!!

Thank you!

ODBC VFP Driver doesn't work well in a multiple user environment. Even if sqlConnect() returns 1 on all instances, the sqlExec() returns -1 on a multiple user environment. I need help on how can I make it work with multi users. Please. Thanks, pls email me williestrada@yahoo.com

I try this and its work on local server (windows 2008 64 bit) but when I try to access via citrix, it can not run/make connection .
somebody pls help :(

Hi Wira,

did you find a solution?

Add new comment

Filtered HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.