Paradox Community
Search:

 Welcome |  What is Paradox |  Paradox Folk |  Paradox Solutions |
 Interactive Paradox |  Paradox Programming |  Internet/Intranet Development |
 Support Options |  Classified Ads |  Wish List |  Submissions 


Paradox OCX Internet/Intranet Articles  |  Non-OCX Internet/Intranet Articles  


Using ColdFusion with Paradox® Tables
© 2001 Roy Frieband

This example has been tested using Windows® 98, Cold Fusion Server 4.0, MS PWS (Personal Web Server), Paradox 9, INTERSOLV® Paradox ODBC driver (ships with Paradox 9).

Preface

ColdFusion offers a way to continue to use your Paradox tables if you need to web enable your database and using the Corel® Web Server OCX is not an option. In addition the company offers a "lite" version called ColdFusion Express that may be downloaded for free. While it only contains a subset of the functionality of the full product, it is still very functional. Combine this with hundreds of ISP's hosting ColdFusion at a reasonable price and you have a viable option for getting your Paradox database on the web at a reasonable cost.

There are 3 parts to using ColdFusion with Paradox tables:


1. Setting Up Paradox as a ColdFusion datasource.

From the Windows control panel double click the icon that says ODBC Data Sources (32bit). Click the Drivers tab of the dialogue box (4th tab). In the list look for a driver named INTERSOLV 3.11 32-BIT ParadoxFile (*.db). If you don't see this driver on the list then it is not installed and you need to install it from the Paradox 9 CD. If you see the driver then you are ready to proceed.

Click on the second tab of the dialogue box, the one that says System DSN. Click the Add... button. From the list that pops up choose the Paradox driver and click the Finish button. You are then presented with the ODBC Paradox Driver Setup Form. On the General tab the first field is for Data Source Name (basically the same as an alias name in Paradox). The name you type in here is the same name you will use to reference your tables in a ColdFusion query. The second field is for description. This can be anything you want. The third field is for Database Directory and this is where you set up the path your datasource (i.e. alias) will point to. Note you can use a hard coded path or a Paradox alias. So :MYALIAS: will work fine here.

Then go to the Advanced tab. The first field is the location of the net file if you are accessing shared network data. The third field is Create Type and this is where you can tell it to use version 7 tables, as opposed to the MS drivers which only go up to version 5. For the rest of the fields, you can read the help files to find out more about what they do. Then click the OK button and you should see the name of your datasource appear in the ODBC Data Sources form. Close the form, this part is done.


2. Verifying the connection

Prior to this step make sure your web server and ColdFusion server are running. Open the ColdFusion Administrator (found in the ColdFusion 4 Server folder). In the frame on the left click the link that says ODBC. You should see the datasource name you set up in the last step in the Data Sources available list. Next to it is a hyperlink that says Verify. Click on this and it should tell you the connection was verified. You are now ready to access your data. Close the Administrator.


3. Using ColdFusion to access the data

Create a test table in Paradox with 3 fields: ID, FirstName, LastName. Make the ID field a LongInt type. Be sure this table is in the directory or alias pointed to by the datasource you previously set up. Name the table cftest.db and add 3 or 4 records to the table.

Create a ColdFusion page in any text editor. Note that the page must be saved below the root directory of your server. So for MS PWS for example you would save the page somewhere below C:\Inetpub\wwwroot. If you are using your local computer to test the app then the page must be saved in the C:\Inetpub\wwwroot\Cfdocs directory. The page must be saved with a cfm extension. For this example lets name it cftest.cfm.

To query out the data from your Paradox tables:
<CFQUERY NAME="MyTest" DATASOURCE="YourDatasourceName">
SELECT ID, FirstName, LastName
FROM cftest.db
</CFQUERY>
To output your queried data to the browser:
<CFOUTPUT QUERY="MyTest">
#ID# #FirstName# #LastName#<BR>
</CFOUTPUT>
Putting it all together your cftest.cfm page would look like this:
<HTML>
 <HEAD>
  <TITLE>Paradox CF Test</TITLE>
 </HEAD>
<BODY>
 <CENTER>
  <B>First Cold Fusion Paradox Page</B><BR>
 </CENTER>

<CFQUERY NAME="MyTest" DATASOURCE="YourDatasourceName">
SELECT ID, FirstName, LastName
FROM cftest.db
</CFQUERY>

<CFOUTPUT QUERY="MyTest">
#ID# #FirstName# #LastName#<BR>
</CFOUTPUT>

</BODY>
</HTML>
Run this page from your browser and you should be seeing your Paradox data live on the web. Note that you cannot run a ColdFusion page from your hard drive (i.e. by double clicking it in Explorer). It must be run from the web server. So to run this example you would type the url: http://127.0.0.1/CFDOCS/cftest.cfm into your browser.

To Insert Data From ColdFusion into your Paradox tables:

You would probably be inserting data using form variables but for the purpose of this example I will insert static values.
<CFQUERY NAME="AddRec" DATASOURCE="YourDatasourceName">
INSERT INTO cftest.db (ID, FirstName, LastName)
VALUES (3000, "Roy", "Frieband")
</CFQUERY>
Add the above code with the starting and ending HTML tags and save with a cfm extension. When the page is run it will add a record with the above values into the cftest.db table you previously created.


Summary

The relative ease of learning the basics of ColdFusion along with the low cost of implementation would seem to create a variety of opportunities for Paradox users to provide access to their databases via the internet. There might be a place for this kind of implementation alongside the Paradox OCX in certain situations, in situations where the OCX could not be used, and to be able to exchange or update data seamlessly between your main Paradox application and your tables that reside on the web server. It should be noted that not all ISPs that host ColdFusion allow ODBC access to Paradox tables, although there are many that do. If you decide to look for a host make sure you will be able to use your Paradox tables.


Discussion of this article


 Feedback |  Paradox Day |  Who Uses Paradox |  I Use Paradox |  Downloads 


 The information provided on this Web site is not in any way sponsored or endorsed by Corel Corporation.
 Paradox is a registered trademark of Corel Corporation.


 Modified: 15 May 2003
 Terms of Use / Legal Disclaimer


 Copyright © 2001- 2003 Paradox Community. All rights reserved. 
 Company and product names are trademarks or registered trademarks of their respective companies. 
 Authors hold the copyrights to their own works. Please contact the author of any article for details.