Your full service technology partner! 
-Collapse +Expand
Search Paradox Group:

-Collapse +Expand Paradox To/From
-Collapse +Expand Paradox Store

Prestwood eMagazine

August Edition
Subscribe now! It's Free!
Enter your email:

   ► KBDesktop Data...Paradox & Ob...ObjectPAL Co...OPAL: Commands   Print This     
  From the November 2015 Issue of Prestwood eMag
Paradox OPAL: Commands:
Paradox and the Internet
Posted 13 years ago on 12/29/2007 and updated 7/6/2008
Take Away:

Using Paradox internet features. Content from chapter 25 of my "Paradox Power Programming: The Official Guide" book.


[2008-07-06: Code samples cleaned up.-MP]

Paradox has many features that integrate, use, or support the Internet. You can add simple hyperlinks to your applications or build a complete Internet site using Paradox as a web server. This chapter will introduce you to techniques for utilizing Paradox on the Internet.

Note: There is a great PDF document included in the Reference Center on the Paradox CD titled jPdox Web Utilities which documents how Paradox integrates with the Internet. In addition to reading this chapter, I suggest you read that document as well.

Setting up hyperlinks

Paradox supports the following Internet protocols for hyperlinks:

  • HTTP
  • FTP
  • NEWS

When you execute a hyperlink in ObjectPAL, Paradox will use the appropriate Internet protocol to follow the link (for example, HTTP will launch the default browser and MAILTO will open a new message in the default mail program).

Launching the Default Browser

You can add the ability to launch the default browser and display a web page. This is particularly handy these days for adding options to the Help menu of your product. For example, you can add the following options to your Help menu (each pointing to a separate page on the internet): Product Support, Product Upgrades, FAQ, and Order Information. To add a button to a form which launches your browser to the home page of Prestwood Software & Consulting, do the following:

method pushButton(var eventInfo Event)



Hyperlinking with the Text Expert

This next section will also set up a hyperlink this time using the Text Expert. To follow this example, make sure the Run experts when creating objects on documents is checked on the Experts tab of the Preferences dialog box.

Step By Step

Create a new form and place a text object on it. The Text Expert wizard displays.

Type PrestoNet into the text field (see figure 1). Press Next.

Figure 1: Text Expert Dialog 1

Set the style of the text (see figure 2). Press Next.

Figure 2: Text Expert Dialog 2

Select Hyperlink and type (see figure 3). Press Next, then Finish.

Figure 3: Text Expert Dialog 3

Notice the link has the default characteristics of a hyperlink. Whenever you use the experts it is a good idea to study the ObjectPAL that was added. In this case, take a look at the mouseClick event of the text object.

Importing Data from HTML Pages

You can use the HTML Import Expert to import data in tables or lists embedded in HTML pages. To get to the HTML Import Expert, select Tools | Experts and select the HTML Import option (see figure 4).

Figure 4: Opening the HTML Import Expert

Publishing to HTML

Perhaps the most common technique you will use to publish Paradox data on the Internet is to use the HTML Table Expert. This expert offers both static and dynamic publishing.

Web Server Repository

Use the Web Server Repository to store, view, and edit GXEngine templates for dynamic HTML publishing. The Web Server Repository is a set of Paradox tables located in the websrv/WebRepos folder. Whenever you use File | Publish to HTML and select a dynamically published document, it is also added to the Web Server Repository. It is a storage facility for HTML template files. Click Tools | Web Server Repository to view a list of stored templates. Choose the Template tab to view their contents.

Publishing Static Documents

Static documents are generated once as HTML and do not change. The benefit of static pages is that they can be posted to any type of Web Server (NT, Unix, Mac, etc.). Paradox can publish simple forms, tables, and reports as static documents. Use the File | Publish to HTML" (forms and tables) or "File | Publish As | HTML" (reports) while you have either a form, table, or report open.

When you have a form open, you can publish it as a static HTML document. This feature works best with simple forms that use text, edit boxes, list boxes, radio buttons, and check boxes. Form objects such as graphics, table frames, crosstabs, notebooks and charts do not translate statically to HTML.

When you have a table open and select File | Publish to HTML, the HTML Table Expert displays. The HTML Table Expert allows you more freedom than publishing simple forms. You can choose which fields, the HTML title, color scheme, whether you want the document to be static or dynamic, and whether you want to save the document as an HTT document. Figure 5 shows the Customer table in Netscape after the table was published as a static table.

Figure 5: A static table document

With the Report in Run Mode, you must Select File | Publish As | HTML to display the Report HTML Expert. The HTML Report Expert gives you more options than either static table or form documents. When you use bands in a report, the HTML Report Expert offers you the option of having drill down data. For example, the Customer report is grouped by Country. When you publish it to HTML, you have the option of having one page for the whole report or one page listing all the countries and one page for each country. Refer to figures 25.6 and 25.7.

Figure 6: The first HTML page of the Country report

Figure 7: One of the linked pages from the Country report

Publishing Dynamic Documents

Dynamic pages are built every time the web page is called. Dynamic pages can use either the Corel Web Server or the Corel Report Server. Since these two servers only run on Windows based machines, you are limited to distributing your dynamic pages to Windows based machines like NT.

Roll out the Paradox Internet servers

Paradox comes with several Internet servers you can use to serve up documents to browsers, set up servers on the Internet, or set up your own Intranet. They are the Corel Web Server, Paradox Report Server, Paradox JDBC driver, and JDBC Proxy Server. If that isn't good enough for you, you also get a complete web server in the form of an ActiveX control so you can write your own web server in Paradox using ObjectPAL. (This last one is demonstrated at the end of this chapter.)

The Corel Web Server

The Corel Web Server is a Windows based application and runs on Windows platforms including Windows 95, 98, 2000, and NT. The Corel Web Server acts as an intermediary between Web browsers and Paradox. However, Paradox does not need to be running (or even installed) on the server. The BDE does need to be installed in order to retrieve dynamic reports from the web repository, which is a set of Paradox tables. The Corel Web Server is a fully functional Web server with the following features:

  • HTTP support (version 1.0 and many 1.1 elements)
  • file caching
  • contact (access) logging using the CERN/NCSA Common Log Format plus transaction logging
  • custom MIME types
  • multi-threaded (supports multiple IntraBuilder sessions)

Paradox Report Server

The Paradox Report Server is a Java 1.2 based application that MUST run in a Windows environment. It receives requests from the Paradox Servlet running on a Web-Server(which may be running on the same machine or another machine) and returns the appropriate dynamic HTML web page back to the Web Server. The Report Server forwards web page requests to GXPublish.dll which then produces the HTML page generated dynamically from Paradox tables. Because the Report Server works with GXPublish.dll which then works with the BDE the Report Server must run on the same machine that Paradox is installed on.

Contrast this with the Paradox Servlet (dynpub.jar) which is also Java based, that may run in any environment with a Web Server that supports the Servlet API.

The Paradox JDBC driver

The Paradox Java Database Connectivity ( JDBC ) driver consists of two parts: the JDBC Client & the JDBC server. The JDBC client is available as a jar file, PdxJDBC.jar & is used by a Java Client application/applet to access databases through the JDBC server. The JDBC driver acts as a JDBC-BDE bridge providing a JDBC interface to Paradox. It can be used to access databases accessible through BDE. The JDBC server must be running on a machine with the BDE and is necessary for all transactions involving Web Form Designer clients.

The JDBC Proxy Server

The JDBC Proxy Server is a JAVA based application and runs on any operating system that supports JDK 1.2 including Windows, Unix, and Macintosh. A proxy server is a server used by companies as a security precaution. A proxy server takes requests from clients (typically a web browser) and passes them to the Internet and it also receives replies and passes them to the appropriate client. This layer is where security is usually enforced (the term fire wall is commonly used to describe this process). The JDBC Proxy Server sits between the JDBC Client and the JDBC Server and allows you to set up security.

The JDBC Proxy Server is used to enforce a 3-tier setup for the Paradox JDBC driver with the JDBC Server running on a machine which has access to databases & the Proxy Server running on a machine exposed to the outside network. This allows databases not to be exposed directly to the outside world and allows applets which use the Paradox JDBC components to be setup on a different machine which is running the web server. The Proxy Server takes all requests from the JDBC client & passes them to the JDBC Server, making it appear to the clients that it is the JDBC Server

The proxy server is also necessary when the BDE and JDBC server are located on a machine other than the machine the web server is installed on. The web form, which is a Java applet, makes a direct connection to the JDBC server once loaded. The Java security model, under normal circumstances, does not allow for connections to machines other than the one where the applet came from, so we need the proxy server on the web server machine to pass the requests to the JDBC server.

JRun Servlet Runner

This servlet runner responds to requests for dynamic documents based on the URL by passing that request to the servlet runner (JRun). The servlet runner then responds by running the Paradox Servlet which then makes contact with the Report Server. This allows you to separate browser calls from Paradox and the BDE. The Paradox Servlet (dynpub.jar) requires a sevlet runner that works in conjunction with a web server. JRun is a third party web server plug-in that provides the necessary environment to run servlets. The Web Server which can run on any operating system (Windows, Unix, Macintosh) that supports the Java Servlet API (such as JRun). The benefit of doing this is now you can have two or three tier applications. Two-tier development would consist of the client browser on any platform and a Windows based server (Web Server, Paradox, and BDE). Three-tier could consist of the client browser on any platform, the Web Server integrated with JRun running on any platform, and the Paradox/BDE server running on a Windows based server.

Creating and using dynamic documents

You create dynamic documents the same way you create static documents. You use either the HTML Table Expert or the HTML Report Expert. As stated earlier, these experts are available when you have either a table or report open. Most of the dynamic documents I create are created using the HTML Report Expert because it is more powerful supporting such features as drill down (discussed earlier), banding (grouping), and calculated fields.

To use a dynamic document is simple. Run the Corel Web Server on the machine that you want to serve up the documents (see figure 8). Paradox does not need to be running. The Corel Web Server interacts directly with the HTML document you created and the database engine to create an updated HTML document.

Figure 8: The Corel Web Server

The Corel Web Server has most of the usual settings you would expect in a web server including HTTP port, minimum and maximum connections, timeout, default page, and logging. You can view the properties by right clicking on the Corel Web Server tray icon and select Properties (see figure 9).

Figure 9: The Corel Web Server properties

The Web Form Designer

The Web Form Designer allows you to use Java browser applets to create HTML documents that any Java enabled browser running on any platform including Windows, Macintosh, and Unix can use. You create web forms using the Web Form Designer embedding JavaBeans without writing a single line of code.

As long as the server is a Windows based machine and has the BDE installed, then you can create forms that access any of the data types the BDE can. There is no custom scripting that needs to be done on the client side. Client browsers require the Java 1.2 Plug-in to view published forms created with the Web Form Designer.

The ActiveX Web Server control

With the ActiveX Web Server control you can create your own web server written in Paradox. This ActiveX control is a fully functioning Internet server with these features:

  • HTTP 1.0 support (plus some features of HTTP 1.1)
  • file caching
  • logging using the CERN/NCSA Common Log Format
  • custom MIME types
  • support for cookies (sessions)
  • support for multi-threaded containers, such as Delphi
  • OGI programming interface

Because Paradox forms support OLE controls as a container, you can use the ActiveX Web Server control by placing it in a form. The form is notified when an HTTP GET, POST, or HEAD method is requested by a Web browser client. The Corel Web Server Control supplies its container with an OGI (OLE Gateway Interface) event. An OGI event is an ActiveX control ConnectionPoint event. This allows the container to execute an event-handling procedure in its native code. Custom event behavior can be programmed or the default HTTP response can be accepted.

Using the Web Server Control with Other programs

Does the Corel ActiveX Web Server work with other products like VB and Delphi? Yes it does. It should work with any product that supports OLE controls as a container.

A Paradox Web Server

This final example demonstrates creating a Web Server written in Paradox. This example will combine ObjectPAL, SQL, and HTML. Once completed, you will be able to use an Internet browser to select a city from the Customer table and upon pressing a button display all the customers in that city. You can do this on one machine or you can install Paradox on your server and then call the server machine name from a client machine running a web browser.

First we will build our web server.


Create a blank form and place a Corel Web Server control on it (see figure 10). The Corel Web Server control is available from the ActiveX toolbar.

Figure 10: Set up form

Alter the Var window of the form as follows:

strPath String

Alter the Init event of the form as follows:

method init(var eventInfo Event)
dynFile DynArray[] String
;Get the current path of the form.
splitFullFileName(getFileName(), dynFile)
strPath = dynFile["DRIVE"] + dynFile["PATH"]
;The server is set to the path in strPath in the DoStartup
;of the ServerOCX object.


Alter the DoStartup event of the ActiveX Web Control as follows:

method DoStartUp(var Cancel Logical)
; This is where we set the BasePath.
; This allows the form to be run from
; any directory.
self.BasePath = strPath
;Set the default HTML document.
self.DefaultPage = "index.htm"


Alter the OnGetRequest event of the ActiveX Web Control as follows:

method OnGetRequest(Request OleAuto, Response OleAuto)
	resultstr   String
	tcCustomer  TCursor

   ;The Get_Customers below is what the HTML form passed
   ;to the server from an HTML form's get method.
   if (Request.URI = "/GET_CITIES") then
	;Construct first part of html page (header).
	resultstr = "<HTML>" + chr(13)
	resultstr = resultstr + "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" + chr(13)
	resultstr = resultstr + "<html>" + chr(13)
	resultstr = resultstr + "<head>" + chr(13)
	resultstr = resultstr + "<title>Customer Example</title>" + chr(13)
	resultstr = resultstr + "</head>" + chr(13)
	resultstr = resultstr + "<body BGCOLOR=\"#FFFFFF\">" + chr(13)
	resultstr = resultstr + "<h1 ALIGN=\"CENTER\"><b>Select a City</b></h1>" + chr(13)
	resultstr = resultstr + "<hr>" + chr(13)

	;Build first half of
drop box. Notice the action

;is find_customers and the method is post. We trap for the
	;find_customers value in OnPostRequest.
	resultstr = resultstr + "<form method=\"POST\" action=\"find_customers\">"
	resultstr = resultstr + "<p><select name=\"City\" size=\"1\">"

	;Open Customer table and scan through
	;table adding each city to the Drop Down box. If you
	;have duplicates, you could sort by a secondary index."customer.db")

	;Add city to list box of HTML form
	scan tcCustomer:
	   resultstr = resultstr + "<OPTION VALUE=\"" + tcCustomer."City" + "\">"
	   resultstr = resultstr + tcCustomer."City" + "</OPTION>" + chr(13)

	;Build rest of drop box.
	resultstr = resultstr + "</select><br>"
	resultstr = resultstr + "<input type=\"submit\" value=\"Retrieve\" name=\"City\"></p>"
	resultstr = resultstr + "</form>"

	;Build last portion of page (footer).
	resultstr = resultstr + "<hr>"
	resultstr = resultstr + "</body>"
	resultstr = resultstr + "</html>"

	;Return to browser.
	Response.ResultString = resultstr



Alter the OnPostRequest event of the ActiveX Web Control as follows:

method OnPostRequest(Request OleAuto, Response OleAuto)
	tcCustomer  TCursor
	resultstr   String
	db Database

   if (Request.URI = "/find_customers") then
	;Construct first part of html page (header).
	resultstr = "<HTML>" + chr(13)
	resultstr = resultstr + "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">" + chr(13)
	resultstr = resultstr + "<html>" + chr(13)
	resultstr = resultstr + "<head>" + chr(13)
	resultstr = resultstr + "<title>Customer Example</title>" + chr(13)
	resultstr = resultstr + "</head>" + chr(13)
	resultstr = resultstr + "<body BGCOLOR=\"#FFFFFF\">" + chr(13)
	resultstr = resultstr + "<h1 ALIGN=\"CENTER\"><b>Customer Info</b></h1>" + chr(13)
	resultstr = resultstr + "<hr>" + chr(13)

	;Construct SQL statement. Notice the use
	;of GetField which gets the value from the
	;HTML form request.
	strSQL = "SELECT *
FROM Customer "
	strSQL = strSQL + "where City = \"" + Request.GetField("City") + "\""

	;Read string into SQL variable, open database, and execute sql.
	CDSQL.readFromString(strSQL)":work:");this will open the connection to the local table or SQL table via the alias
	CDSQL.executeSQL(db, tcCustomer) ;execute the SQL statement into an answer table

	;// Create HTML Table Header
	resultstr = resultstr + string("<P><TABLE BORDER=2>", "<TR><TH>No</TH>")
	resultstr = resultstr + string("<TH>Name</TH>", "<TH>Street</TH>", "<TH>City</TH>")

	;// Fill in HTML Table Contents
	scan tcCustomer : 
	resultstr = resultstr + string("<TR>", "<TD>", tcCustomer."Customer No", "</TD>")
	resultstr = resultstr + string("<TD>", tcCustomer."Name", "</TD>")
resultstr = resultstr + string("<TD>", tcCustomer."Street", "</TD>")
	resultstr = resultstr + string("<TD>", tcCustomer."City", "</TD>" + chr(13))

	;Build rest of table.
	resultstr = resultstr + "</TABLE>" + chr(13)

	;Build page footer.
	resultstr = resultstr + "<hr>" + chr(13)
	resultstr = resultstr + "</body>" + chr(13)
	resultstr = resultstr + "</HTML>\r\n" + chr(13)

	;Send back response.
	Response.ResultString = resultstr


Save the form as web_server.fsl and run the form. Leave this server running for the next part. Figure 11 shows the web_server.fsl form after receiving several requests.

Figure 11: A Custom Paradox web server

Now that the server has been created, we need to create an initial HTML page that gets us into the system. Let's keep this simple. Type the following into any text editor (Notepad, PrestoEdit, Wordpad, for example) and save it as index.htm. (Make sure you change the machine name of badzooka to the name of your machine.)


<b>Using a Paradox form as a Web Server</b></h1></center>

<p><a href="http://badzooka/GET_CITIES">Query

Notice the HREF the link above simply says GET_CITIES. The web server OCX embedded in the web_server.fsl form intercepts this request. The form takes care of processing the request and generating the HTML to return. This is done in the OnGetRequest event of the OCX which is embedded in the form. You can also use HTML post form events to send to the OCX and those can be trapped for in the OnPostRequest event. I cold have easily used get_cities.html in place of GET_CITIES if I wanted the request to feel more like a static page.

The final step is to load your favorite browser and open your page. On my machine, the server is called Badzooka, so I type the following URL into the browser:


Because I have index.htm specified as my default page, I could just use the following:


Figures 12, 13, and 14 show the pages in Netscape.

Figure 12: Initial web page

Figure 13: Choose a city

Figure 14: The customers in that city are displayed


Paradox integrates well with the Internet. You can import and export to static HTML documents or you can publish your data dynamically using the various web servers included.

With both the Corel Web Server and Paradox Report Server, you can display data in web browsers that were created with either the HTML Table Expert or the HTML Report Expert. The Corel Web Server is a Windows based machine and therefore runs on Windows platforms such as Windows NT. The Paradox Report Server, on the other hand, is Java based and is platform independent.

For interactive web based applications for use with Java enabled browsers, you can use the Web Form Designer which allows you to embed JavaBeans into HTML documents which will interface with the BDE on the server. The server must be a Windows based server with the BDE installed, but the client browser just needs to be Java enabled.

If all of the servers that come bundled with Paradox are not enough for you, you can write your own web server using the Web Server ActiveX control included. This is a great way to take full advantage of Paradox and all of its features including ObjectPAL, TCursors, queries, and SQL. With this solution, you must build the HTML documents in your code, but you have the freedom and power to do anything ObjectPAL can do. This final solution does not require a Java enabled browser but the server must be a Windows based server running Paradox or Paradox Runtime.

More Info

Blog:  Is Paradox a good Internet solution?

Linked Message Board Threads

 Need some information from the real guru's in Paradox Setup, Vista, etc. MB Topic (3 replies)
 Can't find jPdox Web Utilities (.pdf)... in Paradox Web Stuff MB Topic (5 replies)
 Web Pictures in Paradox Web Stuff MB Topic (1 replies)
 Paradox Web Server in Paradox Web Stuff MB Topic (2 replies)
 Corel web server in ObjectPAL MB Topic (1 replies)
 Web Browser in a Paradox form in Paradox Web Stuff MB Topic (0 replies)
 New to database web design in Paradox Web Stuff MB Topic (5 replies)
 pushButton to route to website in Paradox Web Stuff MB Topic (5 replies)
 Handling interactive error messages in Web Server in Paradox Web Stuff MB Topic (9 replies)
 Web hyperlink in ObjectPAL MB Topic (2 replies)
 Using Corel Web Server in Paradox Web Stuff MB Topic (0 replies)
 Using Corel Web Server in Paradox Web Stuff MB Topic (5 replies)
 Paradox Web Hosting in Paradox Web Stuff MB Topic (2 replies)
 Form on a web sigte in Paradox Web Stuff MB Topic (6 replies)


Share a thought or comment...
Comment 1 of 3


When I try to create a text object using experts, I receive next message :

"No Document Name",
"The HTML Table Expert must be launched from the File | HTML Publish... menu command."

"Click Tools | Web Server Repository to view a list of stored templates. Choose the Template tab to view their contents."
There is  nothing there.

I use Paradox


Posted 12 years ago

Comment 2 of 3

Today I cleaned up this articles code (re-pasted from my P9 book).

Posted 12 years ago

Comment 3 of 3

Paradox and the Internet and more is included as a page content. You will also be check which is showing you as more coding you will be see it in page as all coding is explain as well in a good method.

Posted 10 days ago
Write a Comment...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.

Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P191A1
Enter key:
Article Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #100771 Counter
Since 4/2/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site:

©1995-2020 Prestwood IT Solutions.   [Security & Privacy]