[Prev] [Top] [Contents] (4 out of 4)

Tutorial B

The objective of this tutorial is to learn the basic steps necessary to create a CGI, that includes a user-created DSQL data object.

Before this tutorial can be successfully undertaken, Sapphire/Web and the Gateway must be running and configured on your system. This can be accomplished by following the Steps in Chapter 3, of the Installation Guide.

Procedures

The following Steps help you create a simple DSQL data object, for a Sapphire/Web project.

Step 1. Create a temporary directory, change directory into it. For example:
		% mkdir $HOME/tutorial0b
		% cd $HOME/tutorial0b
Step 2. If it is not currently started, please start Sapphire/Web by typing:
$SAPPHIRE/bin/saweb.sh
Step 3. Set the SAPPHIRE environment variable.

Bourne or Korn shell:
	SAPPHIRE sapphire_directory; export Sapphire
C Shell:
setenv SAPPHIRE sapphire_home
Step 4. If you have not already done so in Tutorial A, put $SAPPHIRE/bin in your path.

Bourne or Korn shell:
		PATH=$PATH:$SAPPHIRE/bin; export PATH
C Shell:
		set path=($path $SAPPHIRE/bin)
Step 5. Once Sapphire/Web comes up, bring up the Document Manager by pressing the Document Manager button
or
by selecting the menu item Tools->Document Manager...
Step 6. Click on the Create New Html Icon
or
select the menu item File->Create.
Step 7. Type
begin.html 
as the name of the first HTML document.
Step 8. Using your HTML editor, change begin.html to the following.
<HTML>
<HEAD><TITLE> Initial Document </TITLE></HEAD>
<BODY>
This is the first document. Click <A 
HREF="GO">here</A> to go to the next.
</BODY>
</HTML>
Your Browser should look similar to Figure 2-8.

Figure 2-8 Netscape Browser with begin.html loaded

Creating the DSQL Object

Step 1. Using your HTML editor, change end.html to the following.:
<HTML>
<HEAD><TITLE> Final Document </TITLE></HEAD>
<BODY>
This is the final document. Insert Data here:
<P>
##Sa_DataDropSite##
</BODY>
</HTML>
Step 2. Create the second HTML template by clicking the Create New Html icon (or selecting the Menu item File -> Create).
Type end.html as the name of the HTML document. Your browser screen should look similar to Figure 2-9.

Figure 2-9 HTML Browser Screen

Step 3. Once you have these two HTML documents, the next step will be to create a DSQL data object.
Step 4. Click the Object Editor button
or
select the menu item Tools->Object Editor
Step 5. From the Object Editor, select the menu item File->New.
An intermediate window will pop up.
Step 6. In the topmost combo box, select DSQL by clicking the arrow-shaped button.
Step 7. Select a database server from the Server list, or if there is only one, click on it.
At this point, a database login window will pop up.
Step 8. Type your DATABASE username and password. If you do not know these, please consult your DBA. (You could also try system defaults like informix/informix, oracle/oracle, sybase/sybase, or sa/[no password]).
Step 9. After you have successfully logged into the database server, select a database from the Database list, or if there is only one, click on it.
Step 10. Once the database server and database are selected, enter test_db, as the name of the DSQL data object in the Selection text field at the bottom of this window
Click OK.

Figure 2-10 Object Editor with DSQL Object Added

Vendor Specific DSQL/SQL

SYBASE

ORACLE

INFORMIX

Testing the DSQL

Step 1. Once you have entered a DSQL statement into the Object Editor,
click the <Test> button at the bottom of the window.
If all goes well, an Object Results Viewer window will pop up.This window will list the return columns, and rows from the database.
Click <OK> to make the Object Results Viewer window close.
Step 2. Save your DSQL object by selecting the menu item File->Save.
Step 3. At the Object Bind Editor, select File->Close.
At this point we have created a dynamic SQL (DSQL) object that queries a database system structure. We will put this data into an HTML template.

Step 1. Open the Object Bind Editor by clicking the Object Bind Editor (New Activator) button
or
selecting the menu item Tools->Object Bind Editor
An intermediate window will pop up.
Step 2. In the document section, select begin.html. In the Anchors section, select HREF=GO.
Click OK.
Step 3. Another window will pop up. In this window, click on the arrow button to bring up the menu of bind types. Select DSQL.
Select the database server and database that were previously selected.
Your DSQL object should appear in a list called DSQL Name.
Click <OK> to select test_db (your object).
This will enable the Object Bind Editor.
Step 4. From the Object Bind Editor, select end.html as the Results<=>Template
The bottom half of the window contains a list of return columns from the DSQL data object test_db.
Step 5. Click the combo box to the right of the first column. This will pop up a list of possible data drop sites (in this case, [None] and Data DropSite).
Click on Data DropSite to select it.

Figure 2-11 Selecting end.html

Step 6. Click OK, then once these options are set, the Project Window appears.
Step 7. Select the Test Icon
or
select the menu item File->Test.
Step 8. Sapphire/Web will prompt you for a project file. Save your project as test.pj.
Step 9. A Web browser will pop up with your first HTML document.
Click here to go the next page.
The second HTML document should now be populated with a list of data from the database. This is now a successful project.


[Prev] [Top] [Contents] (4 out of 4)