This appendix explains how to use PowerBuilder with a Personal Oracle database. PowerBuilder is the principal product of Powersoft, a company that Sybase acquired in late 1994. The examples in this appendix use PowerBuilder 5.0, Enterprise Edition. PowerBuilder's features include
PowerBuilder supports the following objects:
In common with the other application development environments described in these appendixes, PowerBuilder uses a scripting language named PowerScript for event-driven programming. Each object has a set of predefined events for which you can write a script. You can define additional events for an object and invoke PowerBuilder's comprehensive set of built-in functions from an event script.
The first step in using PowerBuilder with Personal Oracle is setting up a database profile. (See Figure C.1.)
Setting up a database profile. To add a profile for Personal Oracle, click New on the Database Profiles screen. A Database Profile Setup screen appears. (See Figure C.2.)
The Database Profile Setup screen. This example uses PowerBuilder's Oracle 7.2 driver to connect PowerBuilder to Personal Oracle. Click More on the Database Profile Setup screen to display the additional profile fields. Type Frayed_Wires for the Profile Name, O72 ORACLE v7.2 for the DBMS, frayed_wires for the Login ID, and helmholtz for the Login Password. (See Figure C.3.)
Setting up a database profile for Personal Oracle. Click OK. The Database Profiles screen displays the new database profile Frayed Wires. (See Figure C.4.)
The Personal Oracle database profile is created. Click OK again. PowerBuilder will now use the new database profile for Personal Oracle. PowerBuilder provides a visual editor, called a Painter, for many of the objects that it supports. For example, the Database Painter provides general database administration capabilities. Once the connection to Personal Oracle has been established, the Database Painter displays the tables accessible by the connected Oracle user FRAYED_WIRES. Highlight the Repair_Header table and click Open. (See Figure C.5.) The Database Painter displays the columns of the Repair_Header table. (See Figure C.6.)
Database Painter displays available tables.
Database Painter displays the selected table's columns.
To further illustrate how PowerBuilder works with Personal Oracle, you can create a datawindow. If you had to describe the PowerBuilder product with one word, it would be datawindow. A PowerBuilder application window typically includes a datawindow control that is associated with a datawindow object. When the DataWindow Painter is invoked, it displays a screen from which you can select an existing datawindow or choose to create a new datawindow. Click New to create a new datawindow. The New DataWindow window appears. (See Figure C.7.) You must make two choices for the new datawindow--;its data source and presentation style. Choose SQL Select for the data source, choose Tabular for the presentation style, and click OK.
Choosing the data source and presentation style for the new datawindow. A list of the tables accessible by the Oracle user FRAYED_WIRES appears. Scroll down to the Repair_Header table, highlight it, and click Open. (See Figure C.8.)
Choosing a table for the new datawindow. Next, you see a list of the columns from Repair_Header. (See Figure C.9.) To add a column to the new datawindow, simply click the column name. Figure C.10 shows that three columns have been chosen for the datawindow--;Repair_ID, Employee_ID, and Customer_ID.
Selecting columns for the datawindow.
Three columns are selected for the datawindow. Select File | Design to continue defining the new datawindow. Figure C.11 shows the generated datawindow. With a little work, you can modify the appearance of the datawindow by adding 3-D borders, changing the background color, repositioning fields, and changing the text size. (See Figure C.12.)
The generated datawindow.
The modified datawindow. At this point, you're ready to test your datawindow. Select Design | Preview. The DataWindow Painter retrieves rows from Repair_Header and displays the results in the datawindow. (See Figure C.13.) You can use the tools in Preview mode to review the contents of the table, modify values, or insert new rows into the table.
Previewing the datawindow. To save the datawindow, select File | Save As. Specify a name for the new datawindow. (See Figure C.14.) PowerBuilder stores objects in a library file with a .PBL extension. As a result, object names aren't limited to eight characters because they are not stored as DOS files.
Saving the datawindow.