• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

setting up a DB connection to a .DBF using CF

Hi all,
I am on an intranet and there's a network drive that has a .DBF file containing a product catalog (price,cost,SKU, etc.) for our sales registers.  As of right now there is no way to add/delete/update this catalog unless you use the sofware application tbat uses the file (which is located only on the PC that has the register).  

I would like to create a back-end in CF that can be used to manipulate the file's data (change product costs,prices, etc.) using cfquery (SQL) like you can do with an access DB...that way I can manage the catalog from another PC on the network.  I've read a limited amount of information about establishing a connection to a .DBF, and it appears it's similar to setting up an excel file.  

specifications of note:
using CF MX 6
this is an intranet with several drives and setting up a datasource would not be a problem in CF administrator...however, I are not sure which driver (if any to use)

Any thoughts?
  • 3
1 Solution
Renante EnteraCommented:
Hi scripkilla!

To accomplish what you want to achieve, follow these steps :

1.  Configure your system data source on ODBC Data Source Administrator.
     - click Start > Settings > Control Panel > Administrative Tools > Data Sources (ODBC)
     - go to System DSN tab then click Add
     - you will be prompted to select a driver, choose "Microsoft dBase driver (*.dbf)" then click "Finish"
     - setup wizard will appear
     *Note : Specify a "Data Source Name" and of course disable "Use Current Directory" then click "Select Directory" and locate where the database file is located.

2.  Configure data source on CF Administrator.
     - I will assume that you will already know what to do in here.  Just let me know if need some assistance.
     *Note : Be sure that you will use an ODBC socket for your driver and of course the "ODBC DSN" is the system DSN that you've created on step 1.

3.  Create a simple query on your cfm file.
     - Selecting records then display
       <cfquery name="qGetRecord" datasource="DSN">
         Select * From Tablename
       <cfoutput query="qGetRecord">
         #currentrow#. #price# <br> <!--- And so on and so forth ... --->

:: Reminders ::
   a.  If the database file is located on another PC within the network then the root folder must be shared.
   b.  Since shared database, the server machine will have to "map drive" the shared folder.  Take note the drive since this will be needed on configuring the System DSN on step 1.
   c.  Be sure to verify the data source created on step 2 to avoid errors during running queries on your .cfm files.

Hope this helps you.  Just try it then let me know the result.

eNTRANCE2002 :-)
scripkillaAuthor Commented:
Thanks eNTRANCE2002,

I will let you know in the near future what becomes of this - your instructions are hard to mess up!  Great job and if this works the points are yours!
Renante EnteraCommented:
Hi scripkilla!

Just keep me updated regarding this matter.  And of course, I will assist you on solving this problem.

eNTRANCE2002 :-)
Renante EnteraCommented:
Hi mrichmon!

Maybe, you can evaluate my comment since you're one of the EXPERTS on this TA.  Then probably, you can decide whether it helps or not.

But I think it deserves to be accepted 'coz I'm guiding the asker on the right track.  Am i right ???

eNTRANCE2002 :-)

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now