HP 3000 Manuals

ATTACH [ IMAGE/SQL Administration Guide ] MPE/iX 5.0 Documentation


IMAGE/SQL Administration Guide

ATTACH 

Attaches a TurboIMAGE/XL database to an SQL DBEnvironment.

Syntax 

AT[TACH] [WITH OWNER=OwnerName]

Parameters 

OwnerName     specifies an owner for all SQL objects that need to be
              created for the attached TurboIMAGE/XL database.  This name
              can be up to 17 bytes in length and can be made up of any
              combination of letters (A to Z), decimal digits (0 to 9),
              $, #, @, or _ (underscore).  However, the first character
              cannot be a decimal digit or an underscore.  Lowercase
              letters are automatically converted to uppercase letters.
              Note that group and account names are not included in the
              OwnerName parameter.

              If this parameter is omitted, the owner name defaults to
              the name of the TurboIMAGE/XL database defined in the most
              recent SET TURBODB command.

Prerequisites 

   *   SET SQLDBE issued.
   *   SET TURBODB issued.
   *   DBA authority.
   *   Database detached.

Description 

Use the ATTACH command to attach a TurboIMAGE/XL database to a
DBEnvironment.  This command can only be used after the database name and
the DBEnvironment name have been specified with SET commands.
[REV BEG]

You need exclusive access to the DBEnvironment when using the ATTACH
command, because it is required for the first ATTACH command.  Use the
ISQL SELECT command to find out if it is being accessed by users.
_________________________________________
|                                       |
|     :RUN ISQL.PUB.SYS                 |
|     >isql=> SELECT * FROM SYSTEM.USER;|
|     >isql=> exit;                     |
_________________________________________

            
[REV END]

When a database is attached to a DBEnvironment, only the DBC is defined
as an IMAGE/SQL user and default data type mapping is performed.  Once
attached, IMAGE/SQL utility commands can be used to update this default
information.  Refer to the ADD USER, UPDATE USER, UPDATE TYPE, and SPLIT
commands for more information.

A database already attached to a specific DBEnvironment cannot be
reattached.  If you attempt to do this, an error message is issued.

To attach databases with the same database name but in different groups
and accounts to the same DBEnvironment, you must use the OwnerName 
parameter to specify a different owner name for all but the first such
database you attach.

If the DBEnvironment does not exist, IMAGE/SQL displays this message:

     DBE does not exist, do you want to create one? [Y/N] :

If you reply 'Y', a DBEnvironment and DBE files are automatically created
for you.  The files created are:

-------------------------------------------------------------------------------------------
|                                                                                         |
|                File Created                                  File Name                  |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| DBEConFile                                  DBEnvironmentName                           |
|                                                                                         |
| DBEFile                                     DBEnvironmentNameFL                         |
|                                                                                         |
| LOG file                                    DBEnvironmentNameLG                         |
|                                                                                         |
| ATCINFO file                                DBEnvironmentNameCR                         |
|                                                                                         |
-------------------------------------------------------------------------------------------

For example, if you issue the command

     SET SQLDBE MYDBE

and the DBEnvironment MYDBE does not exist, these files are created:
MYDBE, MYDBEFL, MYDBELG, and MYDBECR.

The default size of DBEFile and LOG file is 1000 pages.  The maximum for
DBEFile is 5000 pages.

Example 

In the following example, SALES is attached to PARTSDBE. The accompanying
message summarizes the mapping that took place during the attach.
___________________________________________________________________
|                                                                 |
|     >>SET TURBODB SALES                                         |
|     >>SET SQLDBE PARTSDBE                                       |
|     >>ATTACH                                                    |
|     Split 1 compound source field(s) (ATCWARN 32063).           |
|     Mapped 15 source table/source field name(s) (ATCWARN 32062).|
|     Mapped 1 incompatible source type(s) (ATCWARN 32061).       |
|     >>                                                          |
___________________________________________________________________

            

To see the specific mapping for each data set and field, use the DISPLAY
MAP command.  In the example below, the display notes that the data type
mapping performed for the mapped column CREDIT_RATING is imprecise.  Also
noted is the splitting of the compound source field OTHER_VENDORS into
three mapped columns.
_________________________________________________________________________________
|                                                                               |
|     >>DISPLAY MAP                                                             |
|                                                                               |
|     TurboIMAGE/XL DB : SALES.SERED.ATC                                        |
|     DBEnvironment    : PARTSDBE.SERED.ATC                                     |
|     Owner Name       : SALES                                                  |
|                                                                               |
|     MAPPED(SOURCE)   SOURCE             MAPPED       SOURCE     MAPPED        |
|        TABLE         FIELD              COLUMN        TYPE       TYPE    NOTES|
|     ------------ ---------------- ------------------ ------- ----------- -----|
|                                                                               |
|     DATE_MASTER (DATE-MASTER)                                                 |
|                  DATE             DATE               X6      CHAR(6)          |
|                                                                               |
|     CUSTOMER (CUSTOMER)                                                       |
|                  CUSTOMER#        CUSTOMER#          J2      INTEGER          |
|                  LAST-NAME        LAST_NAME          X16     CHAR(16)         |
|                  FIRST-NAME       FIRST_NAME         X10     CHAR(10)         |
|                  INITIAL          INITIAL            U2      CHAR(2)          |
|                  STREET           STREET             X26     CHAR(26)         |
|                  CITY             CITY               X12     CHAR(12)         |
|                  STATE            STATE              X2      CHAR(2)          |
|                  ZIP              ZIP                X6      CHAR(6)          |
|                  CREDIT-RATING    CREDIT_RATING      R2      FLOAT       I    |
_________________________________________________________________________________

            

(Example continued on next page)

______________________________________________________________________________
|                                                                            |
|     PRODUCT (PRODUCT)                                                      |
|                  PRODUCT#         PRODUCT#           U8      CHAR(8)       |
|                  PRODUCT-DESCRIPT PRODUCT-DESCRIPT   X20     CHAR(20)      |
|                                                                            |
|                                                                            |
|     VENDOR (VENDOR)                                                        |
|                  VENDOR           VENDOR             X16     CHAR(16)      |
|                  STREET           STREET             X26     CHAR(26)      |
|                  CITY             CITY               X12     CHAR(12)      |
|                  STATE            STATE              X2      CHAR(2)       |
|                                                                            |
|     INVENTORY (INVENTORY)                                                  |
|                  PRODUCT#         PRODUCT#           U8      CHAR(8)       |
|                  ON-HAND-QTY      ON_HAND_QTY        J2      INTEGER       |
|                  VENDOR           VENDOR             X16     CHAR(16)      |
|                  OTHER-VENDORS    OTHER_VENDORS_1    X16     CHAR(16)     S|
|                  OTHER-VENDORS    OTHER_VENDORS_2    X16     CHAR(16)     S|
|                  OTHER-VENDORS    OTHER_VENDORS_3    X16     CHAR(16)     S|
|                  UNIT-COST        UNIT_COST          P8      DECIMAL(7,0)  |
|                  LAST-SHIP-DATE   LAST_SHIP_DATE     X6      CHAR(6)       |
|                  LOCATION-BIN     LOCATION_BIN       Z2      DECIMAL(2,0)  |
|                  PART-INFO        PART_INFO          X60     CHAR(60)      |
|                                                                            |
|     SALES (SALES)                                                          |
|                  CUSTOMER#        CUSTOMER#          J2      INTEGER       |
|                  PRODUCT#         PRODUCT#           U8      CHAR(8)       |
|                  QUANTITY         QUANTITY           I1      SMALLINT      |
|                  PRICE            PRICE              J2      INTEGER       |
|                  TAX              TAX                J2      INTEGER       |
|                  TOTAL            TOTAL              J2      INTEGER       |
|                  PURCHASED-DATE   PURCHASED_DATE     X6      CHAR(6)       |
|                  DELIVERED-DATE   DELIVERED_DATE     X6      CHAR(6)       |
|                                                                            |
|     NOTES:                                                                 |
|       I: Imprecise(float)/Incompatible(others) mapping between source and  |
|          mapped data types                                                 |
|       S: Source field has been split                                       |
|     >>                                                                     |
______________________________________________________________________________

            



MPE/iX 5.0 Documentation