3 Programming the DB Connection Function
3-2
NJ/NX-series Database Connection CPU Units User’s Manual (W527)
3-1 DB Access Procedure
This section describes a specific programming procedure for using the DB Connection Service.
Refer to the NJ/NX-series CPU Unit Software User’s Manual (Cat. No. W501) for the general
programming procedure.
Use the following procedure to access the DB using DB Connection Instructions after making the
DB Connection settings.
After the DB mapping*, you can read from and write to the DB using record processing
instructions such as DB_Insert, DB_Update, and DB_Select instructions.
DB mapping* Create a structure data type for DB access.
Refer to 3-2 Creating a
Structure Data Type.
↓
Create a variable called “DB Map Variable” using the
above structure.
Refer to 3-3 Creating a DB
Map Variable.
Establish a DB Connection by executing a
DB_Connect (Establish DB Connection) instruction.
Refer to 4-2
Establishing/Closing a DB
Connection.
Create a mapping from the DB Map Variable to a
specified table by executing a DB_CreateMapping
(Create DB Map) instruction for each SQL type (i.e.,
INSERT, UPDATE, and SELECT).
Refer to 3-4 Specifying the
Table and Applying the
Mapping.
DB read/write
Execute the DB_Insert (Insert DB Record),
DB_Update (Update DB Record), and DB_Select
(Retrieve DB Record) instructions.
Refer to 3-5 Programming
Using the DB Connection
Instructions.
* The DB mapping means to assign each member of a structure for DB access to each column of a table.
You need to execute the DB mapping for each SQL type (i.e. INSERT, UPDATE, and SELECT).