My company has a legacy application built in FoxPro 9 which contains a table that I need to extract data from on a recurring basis. I have never worked with FoxPro. Apparently in FoxPro each table has a corresponding .dbf file. For this example we will say that the table file is
persons.dbf, which resides at
The first step for connecting ColdFusion to the FoxPro database was to find an acceptable driver. I initially tried to use some ODBC drivers but abandoned this route. Not only was it just not working, but I do my development on a Mac (whereas production is Windows) and I really wanted a solution that did not involve a Windows and a Mac configuration.
So the following steps describe how I set up a jdbc connection to FoxPro 9 from ColdFusion.
- Download the StelsDBF JDBC Driver
- Place the dbfdriver.jar file in
- Restart the ColdFusion services
- Login to the CFADMIN and set up a Data Source
- For ‘Data Source Name’ enter ‘legacyapp’
- For ‘Driver’ select ‘Other’
- Click ‘Add’
- For JDBC URL enter ‘jdbc:jstels:dbf:c:/legacyapp/data’
- For Driver Class enter ‘jstels.jdbc.dbf.DBFDriver2’
- Click ‘Submit’
- When using cfquery to select data use the file name as the table name:
SELECT LASTNAME, FIRSTNAME FROM persons
It was actually not too bad to set up once I located the driver.