HPlogo IMAGE/SQL Administration Guide: HP 3000 MPE/iX Computer Systems > Chapter 3 Understanding IMAGE/SQL

How IMAGE/SQL Works

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

IMAGE/SQL users can select data in mapped tables in the same way that data in ALLBASE/SQL tables is selected.

To understand how this is accomplished, you need to know:

  • What files are used by IMAGE/SQL

  • How IMAGE/SQL files are used

  • What takes place during the attach/detach process

  • How IMAGE/SQL maps TurboIMAGE/XL security

  • How IMAGE/SQL maps TurboIMAGE/XL data types

  • What takes place at run time

IMAGE/SQL Files

IMAGE/SQL creates two files: the ATCINFO file with a default name of DBEnvironmentNameCR in the same group and account as the DBEnvironment and DBNameTC in the same group and account as the TurboIMAGE/XL database. This is shown in Figure 3-1 “Files Created by IMAGE/SQL”.

Figure 3-1 Files Created by IMAGE/SQL

[Files Created by IMAGE/SQL]

These files contain information about the relationships between all attached TurboIMAGE/XL databases and their DBEnvironments. Specifically:

ATCINFO

is a permanent privileged file in the same group and account as the DBEnvironment. It contains mapping information about each TurboIMAGE/XL database attached to the DBEnvironment. One ATCINFO file exists for each DBEnvironment.

It is named DBEnvironmentNameCR where DBEnvironmentName is up to six characters of the actual DBEnvironmentName unless a file equation has been set before the attach. The ATCINFO filename is placed in the DBECon file of the DBEnvironment so that it can be located whenever IMAGE/SQL needs to use or update the information in this file.

DBNameTC

is a permanent privileged file in the same group and account as the TurboIMAGE/XL database. It contains the fully qualified names of the DBEnvironments to which the TurboIMAGE/XL database is attached. This information is used to let external utilities such as DBUTIL know that the database is attached to one or more DBEnvironments.

What Takes Place During an Attach?

An attach is the process that establishes the connection between the TurboIMAGE/XL database and the DBEnvironment. Figure 3-2 “A TurboIMAGE/XL Database and a DBEnvironment Before the Attach” shows a TurboIMAGE/XL database and DBEnvironment before the TurboIMAGE/XL database is attached.

Figure 3-2 A TurboIMAGE/XL Database and a DBEnvironment Before the Attach

[A TurboIMAGE/XL Database and a DBEnvironment Before the Attach]

When the TurboIMAGE/XL database is attached to the DBEnvironment, several events take place:

  1. The ATCINFO (DBEnvironmentNameCR) and DBNameTC files are created.

  2. Definitions of the TurboIMAGE/XL mapped tables are placed in the system catalog of the DBEnvironment. These entries in the system catalog identify the tables as mapped tables. The naming convention for SQL tables is OwnerName.TableName. By default, in mapped tables, IMAGE/SQL specifies the database name as the owner name and the data set name as the table name. Thus, the naming convention for mapped tables is MappedDatabaseName.MappedDataSetName. (At attach time, you must substitute a different owner name if an already attached database has the same name.)

  3. Definitions of the TurboIMAGE/XL mapped columns are placed in the system catalog of the DBEnvironment.

  4. Definitions for hash indices on TurboIMAGE/XL master key item and detail search items are entered into the system catalog for the DBEnvironment. All master keys, except P and Z data types, are entered as unique hash indices. Definitions for detail search items, as well as master P and Z key types, are entered as non-unique hash indices. These definitions are in the views SYSTEM.IMAGEKEY and CATALOG.IMAGEKEY. With the hash indices, the performance at run-time is much better when the equality operator is used with the SQL statements.

    If the B-Tree index is created for the key item of a master data set using TurboIMAGE/XL, a definition for a unique B-Tree index is placed in the system catalog. In addition, definitions for non-unique B-Tree indices for all of the search items of the detail data sets to which this key item has a path are added in the system catalog. The definitions for these B-Tree indices are in the views SYSTEM.INDEX and CATALOG.INDEX of the system catalog.

  5. If the database is enabled for third-party indexing, definitions for these indices are also added to the system catalog of the DBEnvironment, except for keyword indices and those indices for which the third-party provides no information. These definitions may be for unique or non-unique indices. The definitions are in the views SYSTEM.TPINDEX and CATALOG.TPINDEX of the system catalog. The definitions for third-party indices are also placed in the system catalogs of other DBEnvironments to which the database is attached.

  6. The TurboIMAGE/XL database creator (DBC) is defined in the ATCINFO file as an IMAGE/SQL user. For security reasons, all other IMAGE/SQL users must be explicitly added by the DBC.

Figure 3-3 shows an attached database.

Figure 3-3 An Attached TurboIMAGE/XL Database

[An Attached TurboIMAGE/XL Database]

What Takes Place During a Detach?

When a database is detached, you can no longer use SQL to access TurboIMAGE/XL data. All views based on mapped tables are dropped. This includes views created by users, as well as IMAGE/SQL-created views. Mapped table definitions are removed from the system catalog and all mapping information about the detached TurboIMAGE/XL database is removed from the ATCINFO file. This results in the removal of definitions of hash, B-Tree, and third-party indices from the system catalog.

If you detach the only TurboIMAGE/XL database attached to the DBEnvironment, the ATCINFO file is deleted, and its name is removed from the DBECon file. If you detach the TurboIMAGE/XL database from the only DBEnvironment it is attached to, the DBNameTC file is deleted.

If you plan to restructure the database, or if you want to remove all mapping information about the database from the ATCINFO file, detach the database. If you only want to change the capacity of a data set, you do not need to detach the database.

When the database is detached, all customized mapping information (alternative data types and added IMAGE/SQL users) is lost and must be remapped when the database is reattached. IMAGE/SQL utility command files are useful for this purpose (refer to Tasks 13 and 14 in Chapter 2).

To protect database security, be sure command files that contain passwords and other sensitive information are carefully controlled. (A message notifies you when IMAGE/SQL commands containing maintenance words or passwords have been logged.)