3 Database Definition
The Schema Program
The schema program is used to create the database catalog. Once the database has been defined using the DBDL, a text file containing the definition is created using an editing program (for example, vi). This text file is used by the schema program to generate a listing of the database definition and to produce the database catalog. If a database catalog with the same name is already present on the database server, schema will fail.
Using the Schema Program
To run the schema program, execute the following command from the HP-UX prompt:
schema [options] filename
Options:
- -help
- Give usage (this list)
- -u user
- Set user name to use to logon at the database server. By default, the login id is used.
- -p pswd
- Set password to use to logon at the database server.
- -h host
- The host name on which the database server is running. This defaults to the local system.
- -s service
- The service name or port number used to connect the database server. This defaults to the service name eloqdb.
- -t
- Table of sets to be output (summary of information about the datasets).
- -l
- Routes the result of the schema analysis to the standard output device (stdout). The standard output device can be the screen, a printer, or a file. When the schema command is executed without the -l option, nothing is sent to the standard output device.
- -n
- Tells the schema program not to generate the database catalog. This option is useful when you want to perform a syntax check of the schema file.
- filename
- This variable should be replaced with the name of the text file containing the data definition. The fully-qualified filename is required.
NOTE: You need administrative capabilities on the database server in order to create a database catalog.
Schema Example
To syntax check the file SAD.txt and create the database catalog on the database server running on the local host, enter the followinf command:
schema -l SAD.txt
The file SAD.txt is analyzed and the contents of this file are printed on the screen. If the syntax analysis reveals no errors, the database catalog is generated. To contact a database server other than the default one, you must specify the -h or -s option.
Display:
B1368A SCHEMA (C) COPYRIGHT MARXMEIER SOFTWARE AG 2002 (A.03.10)
BEGIN DATA BASE SAD;
PASSWORDS:
10 SALESMAN;
15 MANAGER;
3 SECRTARY;
ITEMS
ADDRESS, 2 X30;
CITY, X16;
COUNTRY, X12;
DATE, I;
NAME, X30;
OPTION-DESC, X10;
OPTION-PRICE, L;
OPTION-TYPE, I;
ORDER-DATE, I;
ORDER-NO, X10;
PRICE, L;
PRODUCT-NO, I;
PROD-DESC, X30;
REGION, X6;
REGION-DESC, X30;
REGION,TYPE, I;
SALESPERSON, X4;
SHIP-DATE, I; <<MUST BE YYMM>>
STATE, X6;
ZIP-CODE, X8
IITEMS:
PRODUCT-MC = PROD-DESC:6;
CUS-MC = NAME:6;
I-SALES-PROD = SALESPERSON, PRODUCT-NO;
SETS: << Set defintion >>
NAME: DATE, A (3/10,15);
ENTRY: DATE (2);
NAME: ORDER, A (3/10,15);
ENTRY: ORDER-NO (2);
NAME: PRODUCT, M (3,10/15);
ENTRY: PRODUCT-NO (1)
PROD-DESC;
INDEX: PRODUCT-MC;
NAME: LOCATION, M(3,10/15);
ENTRY: REGION (1),
REGION-DESC,
REGION-TYPE;
NAME: OPTION, D (3/10,15);
ENTRY: ORDER-NO (ORDER),
OPTION-DESC,
OPTION-PRICE,
OPTION-TYPE;
NAME: CUSTOMER, DETAIL (3/10,15);
ENTRY: ORDER-NO (ORDER),
NAME,
ADDRESS,
CITY,
STATE,
COUNTRY,
ZIP-CODE,
ORDER-DATE (DATE),
SHIP-DATE (DATE),
REGION (LOCATION),
PRODUCT-NO (PRODUCT),
PRICE,
SALESPERSON;
INDEX: CUS-MC, I-SALES-PROD;
END.
Eloquence Database Manual - 19 DEC 2002