Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating Database for PowerBuilder

162 views
Skip to first unread message

yangashra

unread,
Mar 28, 2006, 11:34:28 PM3/28/06
to
Hi there to all. I have a question that need answers. Could
you all please tell me how to create database for it and
what programs that I can use to create it.
Thank You.
Regards,
Yang Ashra

Terry Dykstra

unread,
Mar 29, 2006, 12:39:03 AM3/29/06
to
You can use any database you like. PB comes with SQLAnywhere / ASA and you
can deploy the runtime engine freely. You can use Access, ASE, Oracle,
SQLServer etc. It depends on what your needs are. Please provide some
info on what you are trying to accomplish. Also, what version of PB
(Desktop, Professional, Enterprise) do you use.

--
Terry Dykstra (TeamSybase)
http://powerbuilder.codeXchange.sybase.com/
http://www.pb9books.com
product enhancement requests:
http://my.isug.com/cgi-bin/1/c/submit_enhancement
<Yang Ashra> wrote in message news:4429fe35.67e...@sybase.com...

yangashra

unread,
Mar 30, 2006, 11:10:46 PM3/30/06
to
I'm using PowerBuilder v8.0 and would like to create a
notification system for my practiculum project. I'd like to
use Access to create the database. Please enlighten me on
what should I create (e.g. tables, queries) for the usage of

Terry Dykstra

unread,
Mar 31, 2006, 1:08:18 AM3/31/06
to
PB can't create the Access database itself, but in the database painter you
can create the tables, views etc.
Hot to design all the tables, relationships etc, that's up to you.

<Yang Ashra> wrote in message news:442c9b98.74...@sybase.com...

Adam Simmonds [TeamSybase]

unread,
Mar 31, 2006, 7:56:55 AM3/31/06
to
Yang Ashra wrote:
> I'm using PowerBuilder v8.0 and would like to create a
> notification system for my practiculum project. I'd like to
> use Access to create the database.

Why oh why would you want to use Access?????

Please enlighten me on
> what should I create (e.g. tables, queries) for the usage of
> it.

Maybe you need to take a class in Databases 101
This is not the correct forum.
a.

yangashra

unread,
Apr 3, 2006, 12:46:53 AM4/3/06
to
Ok then tell me what programs should I use, genius? Don't
answer my question like that.....is not polite
enough......just answer the post properly please...Tq

Regards,
Yang Ashra

Adam Simmonds [TeamSybase]

unread,
Apr 3, 2006, 7:03:41 AM4/3/06
to
Yang Ashra wrote:
> Ok then tell me what programs should I use, genius? Don't
> answer my question like that.....
is not polite
> enough......

I will refer you to the 'genius' comment above and let you
work out who was being polite.

just answer the post properly please...Tq

I did answer it. Dont use access and try doing some
courses/research on database design ( google is a good place
to start ). The "HELP" files are pretty handy as well.

Heres something I found in the help after about 30 seconds.

Working with tables
When you open the Database painter, the Object view lists
all tables in the current database that you have access to
(including tables that were not created using PowerBuilder).
You can create a new table or alter an existing table. You
can also modify table properties and work with indexes and keys.

Creating a new table from scratch
In PowerBuilder, you can create a new table in any database
to which PowerBuilder is connected.

To create a table in the current database:

Do one of the following:

Click the Create Table button.
Right-click in the Columns view and select New Table from
the pop-up menu.
Right-click Tables in the Objects view and select New Table
from the pop-up menu.
Select Insert>Table from the Object menu.

The new table template displays in the Columns view. What
you see in the view is DBMS-dependent.You use this template
to specify each column in the table. The insertion point is
in the Column Name box for the first column.

Enter the required information for this column.

For what to enter in each field, see "Specifying column
definitions".

As you enter information, use the Tab key to move from place
to place in the column definition. After defining the last
item in the column definition, press the Tab key to display
the work area for the next column.

Repeat step 2 for each additional column in your table.

(Optional) Select Object>Pending SQL from the menu bar or
select Pending SQL from the pop-up menu to see the pending
SQL syntax.

If you have not already named the table, you must provide a
name in the dialog box that displays. To hide the SQL syntax
and return to the table columns, select Object>Pending
Syntax from the menu bar.

Click the Save button or selecting Save from the File or
pop-up menu, then enter a name for the table in the Create
New Table dialog box.

PowerBuilder submits the pending SQL syntax statements it
generated to the DBMS, and the table is created. The new
table is displayed in the Object Layout view.

About saving the table If you make changes after you save
the table and before you close it, you see the pending
changes when you select Pending SQL again. When you click
Save again, PowerBuilder submits a DROP TABLE statement to
the DBMS, recreates the table, and applies all changes that
are pending. Clicking Save many times can be time consuming
when you are working with large tables, so you might want
save only when you have finished.

Specify extended attributes for the columns.

For what to enter in each field, see "Specifying column
extended attributes".

Creating a new table from an existing table
You can create a new table that is similar to an existing
table very quickly by using the Save Table As menu option.

To create a new table from an existing table:

Open the existing table in the Columns view by dragging and
dropping it or selecting Alter Table from the pop-up menu.

Right-click in the Columns view and select Save Table As
from the pop-up menu.

The Create New Table dialog box displays.

Enter a name for the new table and then the owner's name and
click OK.

The new table appears in the Object Layout view and the
Columns view.

Make whatever changes you want to the table definition.

Save the table.

Make changes to the table's properties in the Object Details
view.

For more information about modifying table properties, see
"Specifying table and column properties".

Specifying column definitions
When you create a new table, you must specify a definition
for each column. The fields that display for each column in
the Columns view depend on your DBMS. You may not see all of
the following fields, and the values that you can enter are
dependent on the DBMS.

For more information, see your DBMS documentation.

Table 15-5: Defining columns in the Columns view in the
Database painter Field What you enter
Column Name (Required) The name by which the column will be
identified.
Data Type (Required) Select a datatype from the drop-down
list. All datatypes supported by the current DBMS are
displayed in the list.
Width For datatypes with variable widths, the number of
characters in the field.
Dec For numeric datatypes, the number of decimal places to
display.
Null Select Yes or No from the Null drop-down list to
specify whether NULLs are allowed in the column. Specifying
No means the column cannot have NULL values; users must
supply a value. No is the default in a new table.
Default The value that will be placed in a column in a row
that you insert into a DataWindow object. The drop-down list
has built-in choices, but you can type any other value. For
an explanation of the built-in choices, see your DBMS
documentation.

Specifying table and column properties
After a table has been created and saved, you can specify
the properties of a table and of any column in a table.
Table properties include the fonts used for headers, labels,
and data, and a comment that you can associate with the
table. Column properties include the text used for headers
and labels, display formats, validation rules, and edit
styles used for data (also known as a column's extended
attributes), and a comment you can associate with the column.

Specifying table properties
In addition to adding a comment to associate with the table,
you can choose the fonts that will be used to display
information from the table in a DataWindow object. You can
specify the font, point size, color, and style.

To specify table properties:

Do one of the following:

Highlight the table in either the Objects view or the Object
Layout view and select Properties from the Object or pop-up
menu.
Click the Properties button.
Drag and drop the table to the Object Details view.

The properties for the table display in the Object Details view.

Select a tab and specify properties:

Select this tab To modify this property
General Comments associated with the table
Data Font Font for data retrieved from the database and
displayed in the Results view by clicking a Data
Manipulation button
Heading Font Font for column identifiers used in grid,
tabular, and n-up DataWindow objects displayed in the
Results view by clicking a Data Manipulation button
Label Font Font for column identifiers used in freeform
DataWindow objects displayed in the Results view by clicking
a Data Manipulation button

Right-click on the Object Details view and select Save
Changes from the pop-up menu.

Any changes you made in the Object Details view are
immediately saved to the table definition.

Specifying column extendedattributes
In addition to adding a comment to associate with a column,
you can specify extended attributes for each column. An
extended attribute is PowerBuilder-specific information that
enhances the definition of the column.

To specify extended attributes:

Do one of the following:

Highlight the column in either the Objects view or the
Object Layout view and select Properties from the Object or
pop-up menu.
Click the Properties button.
Drag and drop the column to the Object Details view.

Select a tab and specify extended attribute values:

Select this tab To modify these extended attributes
General Column comments.
Headers Label text used in freeform DataWindow objects.
Header text used in tabular, grid, or n-up DataWindow objects.

Display How the data is formatted in a DataWindow object as
well as display height, width, and position. For example,
you can associate a display format with a Revenue column so
that its data displays with a leading dollar sign and
negative numbers display in parentheses.
Validation Criteria that a value must pass to be accepted
in a DataWindow object. For example, you can associate a
validation rule with a Salary column so that you can only
enter a value within a particular range.
The initial value for the column. You can select a value
from the drop-down list. The initial value must be the same
datatype as the column, must pass validation, and can be
NULL only if NULL is allowed for the column.

Edit Style How the column is presented in a DataWindow
object. For example, you can display column values as radio
buttons or in a drop-down list.

Right-click on the Column property sheet and select Save
Changes from the pop-up menu.

Any changes you made in the property sheet are immediately
saved to the table definition.

Overriding definitions In the DataWindow painter, you can
override the extended attributes specified in the Database
painter for a particular DataWindow object.

How the information is stored
Extended attributes are stored in the PowerBuilder system
tables in the database. PowerBuilder uses the information to
display, present, and validate data in the Database painter
and in DataWindow objects. When you create a view in the
Database painter, the extended attributes of the table
columns used in the view are used by default.

About display formats, edit styles, and validation rules
In the Database painter, you create display formats, edit
styles, and validation rules. Whatever you create is then
available for use with columns in tables in the database.
You can see all the display formats, edit styles, and
validation rules defined for the database in the Extended
Attributes view.

For more information about defining, maintaining, and using
these extended attributes, see Chapter 21, "Displaying and
Validating Data ".

About headings and labels
By default, PowerBuilder uses the column names as labels and
headings, replacing any underscore characters with spaces
and capitalizing each word in the name. For example, the
default heading for the column Dept_name is Dept Name. To
define multiple-line headings, press Ctrl+Enter to begin a
new line.

Specifying additional propertiesfor character columns
You can also set two additional properties for character
columns on the Display property page: Case and Picture.

Specifying the displayed case
You can specify whether PowerBuilder converts the case of
characters for a column in a DataWindow object.

To specify how character data should be displayed:

On the Display property page, select a value in the Case
drop-down list:

Value Meaning
Any Characters are displayed as they are entered
UPPER Characters are converted to uppercase
lower Characters are converted to lowercase

Specifying a column as a picture
You can specify that a character column can contain names of
picture files (BMP or WMF files).

To specify that column values are names of picture files:

On the Display property page, select the Picture check box.

When the Picture check box is selected, PowerBuilder expects
to find bitmap (BMP) or Windows metafile (WMF) file names in
the column and displays the contents of the picture
file--not the name of the file--in reports and DataWindow
objects.

Because PowerBuilder cannot determine the size of the image
until runtime, it sets both display height and display width
to 0 when you select the Picture check box.

Enter the size and the justification for the picture (optional).

Altering a table
After a table is created, how you can alter the table
depends on your DBMS.

You can always:

Add or modify PowerBuilder-specific extended attributes for
columns
Delete an index and create a new index

You can never:

Insert a column between two existing columns
Prohibit NULL values for an appended column
Alter an existing index

Some DBMSs let you do the following but others do not:

Append columns that allow NULLs
Increase or decrease the number of characters allowed for
data in an existing column
Allow NULLs
Prohibit NULLs in a column that allowed NULLs

Database painter is DBMS-aware The Database painter grays
out or notifies you about actions that your DBMS prohibits.

For complete information about what you can and cannot do
when you modify a table in your DBMS, see your DBMS
documentation.

To alter a table:

Highlight the table and select Alter Table from the pop-up
menu.

Opening multiple instances of tables You can open another
instance of a table by selecting Columns from the View menu.
Doing this is helpful when you want to use the Database
painter's cut, copy, and paste features to cut or copy and
paste between tables.

The table definition displays in the Columns view (this
screen shows the Employee table):


Make the changes you want in the Columns view or in the
Object Details view.

Select Save Table or Save Changes.

PowerBuilder submits the pending SQL syntax statements it
generated to the DBMS, and the table is modified.

Cutting, copying, and pasting columns
In the Database painter, you can use the Cut, Copy, and
Paste buttons in the PainterBar (or Cut, Copy, and Paste
from the Edit or pop-up menu) to cut, copy, and paste one
column at a time within a table or between tables.

To cut or copy a column within a table:

Put the insertion point anywhere in the column you want to
cut or copy.

Click the Cut or Copy button in the PainterBar.

To paste a column within a table:

Put the insertion point in the column you want to paste to.

If you are changing an existing table, put the insertion
point in the last column of the table. If you try to insert
a column between two columns, you get an error message. You
can only append a column to an existing table. If you are
defining a new table, you can paste a column anywhere.

Click the Paste button in the PainterBar.

To paste a column to a different table:

Open another instance of the Columns view and use Alter
Table to display an existing table or click New to create a
new table.

Put the insertion point in the column you want to paste to.

Click the Paste button in the PainterBar.

Closing a table
You can remove a table from a view by selecting Close or
Reset View from its pop-up menu. This action only removes
the table from the Database painter view. It does not drop
(remove) the table from the database.

Dropping a table
Dropping removes the table from the database.

To drop a table:

Select Drop Table from the table's pop-up menu or select
Object>Delete from the menu bar.

Click Yes.

Deleting orphaned table information
If you drop a table outside PowerBuilder, information
remains in the system tables about the table, including
extended attributes for the columns.

To delete orphaned table information from the extended
attribute system tables:

Select Design>Synch Extended Attributes from the menu bar.

If you try to delete orphaned table information and there is
none, a message tells you that synchronization is not necessary.

Click Yes.

Viewing pending SQL changes
As you create or alter a table definition, you can view the
pending SQL syntax changes that will be made when you save
the table definition.

To view pending SQL syntax changes:

Right-click the table definition in the Columns view and
select Pending Syntax from the pop-up menu.

PowerBuilder displays in SQL syntax the pending changes to
the table definition:


The SQL statements execute only when you save the table
definition or reset the view and then tell PowerBuilder to
save changes.

Copying, saving, and printing pending SQL changes
When you are viewing pending SQL changes, you can:

Copy pending changes to the clipboard
Save pending changes to a file
Print pending changes

To copy, save, or print only part of the SQL syntax Select
the part of the SQL syntax you want before you copy, save,
or print.

To copy the SQL syntax to the clipboard:

In the Pending Syntax view, click the Copy button or select
Copy from the pop-up menu.

To save SQL syntax for execution at a later time:

In the Pending Syntax view, Select File>Save As.

The Save Syntax to File dialog box displays.

Navigate to the folder where you want to save SQL, name the
file, and then click the Save button.

At a later time, you can import the SQL file into the
Database painter and execute it.

To print pending table changes:

While viewing the pending SQL syntax, click the Print button
or select Print from the File menu.

To display columns in the Columns view:

Select Object>Pending Syntax from the menu bar.

Printing the table definition
You can print a report of the table's definition at any
time, whether or not the table has been saved. The Table
Definition Report contains information about the table and
each column in the table, including the extended attributes
for each column.

To print the table definition:

Select Print or Print Definition from the File or pop-up
menu or click the Print button.

Exporting table syntax
You can export the syntax for a table to the log. This
feature is useful when you want to create a backup
definition of the table before you alter it or when you want
to create the same table in another DBMS.

To export to another DBMS, you must have the PowerBuilder
interface for that DBMS.

To export the syntax of an existing table to a log:

Select the table in the painter workspace.

Select Export Syntax from the Object menu or the pop-up menu.

If you selected a table and have more than one DBMS
interface installed, the DBMS dialog box displays. If you
selected a view, PowerBuilder immediately exports the syntax
to the log.

Select the DBMS to which you want to export the syntax.

If you selected ODBC, specify a data source in the Data
Sources dialog box.

Supply any information you are prompted for.

PowerBuilder exports the syntax to the log. Extended
attribute information (such as validation rules used) for
the selected table is also exported. The syntax is in the
format required by the DBMS you selected.

For more information about the log, see "Logging your work".

About system tables
Two kinds of system tables exist in the database:

System tables provided by your DBMS (for more information,
see your DBMS documentation)
PowerBuilder extended attribute system tables

About PowerBuilder system tables
PowerBuilder stores extended attribute information you
provide when you create or modify a table (such as the text
to use for labels and headings for the columns, validation
rules, display formats, and edit styles) in system tables.
These system tables contain information about database
tables and columns. Extended attribute information extends
database definitions.

In the Employee table, for example, one column name is
Emp_lname. A label and a heading for the column are defined
for PowerBuilder to use in DataWindow objects. The column
label is defined as Last Name:. The column heading is
defined as Last Name. The label and heading are stored in
the PBCatCol table in the extended attribute system tables.

The extended attribute system tables are maintained by
PowerBuilder. Only PowerBuilder users can enter information
into the extended attribute system tables. Table 15-6 lists
the extended attribute system tables. For more information,
see Appendix A, "The Extended Attribute System Tables"

Table 15-6: Extended attribute system tables This system
table Stores this extended attribute information
PBCatCol Column data such as name, header and label for
reports and DataWindow objects, and header and label positions
PBCatEdt Edit style names and definitions
PBCatFmt Display format names and definitions
PBCatTbl Table data such as name, fonts, and comments
PBCatVld Validation rule names and definitions

Opening and displaying system tables
You can open system tables in the Database painter just like
other tables.

By default, PowerBuilder shows only user-created tables in
the Objects view. If you highlight Tables and select Show
System Tables from the pop-up menu, PowerBuilder also shows
system tables.

> Regards,
> Yang Ashra

M. Searer

unread,
Apr 5, 2006, 3:45:15 PM4/5/06
to
You should understand that this is a user (unpaid) support forum for help on
specific issues. The 'genius' spent his own unpaid time looking up the answer
to your vague question. In this case, you got a lot more than what you paid
for.

An example of a better question might be 'how do I connect to an access database
within powerbuilder'. Of course this is already in the help and one would have
to wonder why you didn't look yourself.

General questions on how to design and build a specific application are
typically outside the scope of the type of help that can or will be provided.
Sybase has a number of training classes on how to use their tools, as do other
vendors.
You could also hire a consultant.


<Yang Ashra> wrote in message news:44308a6d.3ff...@sybase.com...

Adam Simmonds [TeamSybase]

unread,
Apr 5, 2006, 9:56:18 PM4/5/06
to
M. Searer wrote:
> You should understand that this is a user (unpaid) support forum for help on
> specific issues. The 'genius' spent his own unpaid time looking up the answer
> to your vague question. In this case, you got a lot more than what you paid
> for.
>
> An example of a better question might be 'how do I connect to an access database
> within powerbuilder'. Of course this is already in the help and one would have
> to wonder why you didn't look yourself.
>
> General questions on how to design and build a specific application are
> typically outside the scope of the type of help that can or will be provided.
> Sybase has a number of training classes on how to use their tools, as do other
> vendors.
> You could also hire a consultant.

Spot on, answered much better than I did :)
a.

0 new messages