Previous Topic: PlanningNext Topic: Non-SQL Considerations


SQL Considerations

Connecting an SQL Session

Most SQL applications will connect to the dictionary containing the definitions of the tables to be accessed. If the dictionary is composed of a single segment, no database name is required. If the dictionary is composed of multiple segments, then a database name must be created to identify all segments that make up the dictionary.

The following example shows a dictionary definition composed of three segments: a DDLDML component (testdict), a catalog component (testcat), and a message component (sysmsg):

 .
 .
 .
create dbname testdict
  add segment testdict
  add segment testcat
  add segment sysmsg;

Note: For more information about defining dictionaries, see Chapter 25, "Dictionaries and Runtime Environments".

Accessing Data through a Referencing Schema

If the SQL application accesses data through a referencing schema, the database name to which the SQL session connects may also need to include the segments containing the data to be accessed. Referencing schemas are used to provide SQL access to non-SQL defined databases and to enable different instances of an SQL-defined database to be accessed using the same table names.

When a referencing schema is defined, you can associate it with a specific database. If the referencing schema is not associated with a specific database (because its DBNAME is null), then you must include the segments containing the data to be accessed in the database name to which the SQL session connects.

In the following example, the SQL schema definition representing a non-SQL defined database does not include a DBNAME specification:

create schema empsql
  for nonsql schema empschm;

For CA IDMS to know where the non-SQL defined data is located, you must define a database name that includes both the dictionary segments and the non-SQL segments containing the data. The segment TESTCAT is the segment in which the EMPSQL schema resides. The segment TESTDICT contains the non-SQL schema EMPSCHM. The segment EMPSEG is the non-SQL segment containing the data described by schema EMPSCHM.

 .
 .
 .
create dbname abc
   add segment testdict
   add segment testcat
   add segment sysmsg
   add segment empseg