3 Programming the DB Connection Function
3-18
NJ/NX-series Database Connection CPU Units User’s Manual (W527)
3-4 Specifying the Table and Applying
the Mapping
You need to create a mapping from a DB Map Variable to the DB for each SQL type (INSERT,
UPDATE, and SELECT) before you can execute a record processing instruction (for inserting,
updating, or retrieving records).
This section describes how to create and clear the DB mapping and restrictions.
3-4-1 DB Mapping by Executing a Create DB Map Instruction
Execute a DB_CreateMapping (Create DB Map) instruction for mapping a DB Map Variable to
the connected DB. Specify the Table Name, DB Map Variable, and SQL Type in the
DB_CreateMapping (Create DB Map) instruction.
By doing so, you can map the DB Map Variable to the DB for each SQL type (i.e., INSERT,
UPDATE, and SELECT).
Refer to the explanation for DB_CreateMapping (Create DB Map) instruction in Appendix.
Structure data type definition used by a DB
Map Variable
3-4-2 Clearing the Mapping of DB Map Variables
Mapping of DB Map Variables is automatically cleared by the following operations.
ï‚– When the DB Connection is closed
ï‚– When the DB Connection Service is stopped*
ï‚– When the DB Connection Service is shut down
ï‚– When another mapping is applied to the DB Map Variable (i.e. mapping to a different table or
for a different SQL type)
* Refer to 4-1-3 DB Connection Service is Stopped or Cannot be Started for details on the stop of the DB
Connection Service.
Precautions for Correct Use
Mapping to the DB is automatically cleared when the DB Connection is closed.
Therefore, write the user program so that a DB_Connect (Establish DB Connection)
instruction is executed before a DB_CreateMapping (Create DB Map) instruction.