Accessing a Db2 Table

#### Search Results

Search

# Accessing a Db2 Table

To enable access to a Db2 table with a Natural program

1. Use the Natural Tools for Db2 to define a Db2 table; see Using Natural Tools for Db2.

2. Use Predict or the SQL Services function of the Natural `SYSDDM` utility to create a Natural data definition module (DDM) of the defined Db2 table.

3. Once you have defined a DDM for a Db2 table, you can access the data stored in this table by using a Natural program.

Natural for Db2 translates the statements of a Natural program into SQL statements.

Natural automatically provides for the preparation and execution of each statement. In dynamic mode, a statement is only prepared once (if possible) and can then be executed several times. For this purpose, Natural internally maintains a table of all prepared statements (see Statement Table in Internal Handling of Dynamic Statements).

Almost the full range of possibilities offered by the Natural programming language can be used for the development of Natural applications which access Db2 tables. For a number of Natural DML statements, however, there are certain restrictions and differences as far as their use with Db2 is concerned; see Using Natural Native DML Statements. In the Statements documentation, you can find notes on Natural usage with Db2 attached to the descriptions of the Natural DML statements concerned.

As there is no Db2 equivalent to Adabas internal sequence numbers (ISNs), any Natural features which use ISNs are not available when accessing Db2 tables with Natural.

For SQL databases, in addition to the Natural native DML statements, Natural provides Natural SQL statements; see Using Natural SQL Statements. They are listed and explained in the Statements documentation.