How IMAGE/SQL Works [ HP IMAGE/SQL Administration Guide ] MPE/iX 5.0 Documentation
HP IMAGE/SQL Administration Guide
How IMAGE/SQL Works
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: ATCINFO 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 .
Figure 3-1. 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 ATCINFO unless a file equation has been set
before the attach. Its name 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 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
When the TurboIMAGE/XL database is attached to the DBEnvironment, several
events take place:
1. The ATCINFO 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. 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
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.
If you are detaching 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 are detaching the TurboIMAGE/XL database from
the only DBEnvironment it is attached to, the DBNameTC file is deleted.
Detach if you plan to restructure the database or if you want to remove
all mapping information about the database from the ATCINFO file.
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 12 and 13 in Chapter
2). but 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.)
MPE/iX 5.0 Documentation